Think Twice About Fragment Identifiers in SEO

fragmented links and SEO

Google’s Martin Splitt explains the importance of href attributes and non-crawling of fragment identifiers

Martin Splitt, the developer advocate at Google, recommended to use proper link markup, and do not use fragment URLs for links you want crawlers to discover and follow. You should be building websites that work well with JavaScript and the links will be found for better SEO benefits.

 

The right way to create links for SEO: Using the HTML <a> tag with the destination URL in the href attribute is the most recommended way to create a link. For example, <a href=”https://example.com”>link</a>. When a user clicks on a pop-out hamburger menu on one of your pages — the JavaScript could be used to intercept the href and display the hidden hamburger menu – by adding JavaScript to a link, allowing you to upgrade its functionality.

Don’t leave out the href attribute: It may be tempting to eliminate the href attribute and “clean up” your code, but doing so means that the link will only work if your JavaScript is also functioning properly. Crawlers only access content pointed to with href attributes and if there’s a bug, users can’t access the content the JavaScript is pointing to.

Fragment identifiers not recommended: Fragment identifiers, which are distinguished by a “#” symbol within a URL, point to subsections of a given page, not necessarily a different page. For example, example.com/FAQ#subsection would take the user to a specific point on the page example.com/FAQ.

As long as the fragments aren’t meant to point to the different content of another page, crawlers ignore them. This means that crawlers will not follow those links in single-page application websites with fragment identifiers.

Why SEO cares about links and Javascript: Creating links that Google can crawl will help it understand what your website content is about and increase your chances of ranking well for relevant queries. Since some users may choose to browse with JavaScript turned off, it is evident to ensure that your links still function correctly.

Avatar

About the Author: BW

1 Comment

Leave a Reply

Your email address will not be published. Required fields are marked *