大网数据广告活动
网站运营与故障问答

Are URLs with fragments or paths better for SEO?

· 52CE 我爱测

Suppose I have a food blog (say www.myfoodblog.example ) with several recipes (mango-icecream, banana-icecream, and berry-icecream). So what I understood for SEO is to have these keywords of recipes in URL. I can have that in two…

问题原文

原帖链接 · kg__ · CC BY-SA 4.0

Suppose I have a food blog (say www.myfoodblog.example) with several recipes (mango-icecream, banana-icecream, and berry-icecream). So what I understood for SEO is to have these keywords of recipes in URL. I can have that in two ways:

  • www.myfoodblog.example/mango-icecream (so I direct user to a new webpage)
  • www.myfoodblog.example#mango-icecream (so I direct user to same webpage but to relevant part).

Which of the two methods is more optimal for SEO?

已采纳解答

原帖链接 · Stephen Ostermiller · CC BY-SA 4.0

URLs with a path are significantly better for SEO.

  • Path URLs are server side, fragment URLs are client side.
  • Path URLs can serve content that doesn't rely on JavaScript, fragment URLs are typically powered by client side JavaScript (unless they just scroll the page to a particular point.)
  • Search engine bots have an easier time crawling path URLs compared with fragment URLs, particularly when the path URL page doesn't require JavaScript to display. Of the major search engine bots, only Googlebot can execute JavaScript. Other search engine bots still can't. Even though Googlebot can execute JavaScript, pages that require JavaScript to show the content often have crawl problems and take Googlebot weeks longer to index.
  • If your pages ARE JavaScript powered, path URLs allow you to use pre-rendering to serve a version of the page with less JavaScript reliance. Pre-rendering is not possible with fragment URLs.
  • Fragment URLs don't have their own HTTP status. They can't be redirected or retired the way that path URLs can be. It is difficult to deal with URLs that change or go away. They can't return the appropriate "301 moved permanently" or "410 gone status". Instead you have to rely on client side scripting to setLocation to change the URL.

Given the choice between your examlpe URLs I would choose www.myfoodblog.example/mango-icecream for SEO.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Webmasters Stack Exchange
适用范围
以原帖系统、软件版本与发布日期为准(2021-08-03)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。