2

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?

1
  • 1
    I edited terminology into your post. The "URL path" is the portion of the URL starting with a slash after the domain name and ending at the ? or #. /mango-icecream is an example of a URL path. The fragment identifier is the portion of URL from the # to the end. #mango-icecream is an example of a fragment identifier. Although you don't ask about it in this question, it is possible for a URL to have both a path and a fragment as well as a query string: https://domain.example/path?query=string#fragment Aug 3 at 14:12
2

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.