Many websites miss the HTML id or name attributes (no support for fragment URI's), what to do about it?

by hitchhiker   Last Updated February 23, 2018 22:04 PM

I like the idea that HTML header elements have the id attribute. It allows to share links with fragments like for example with Wikipedia:

https://en.wikipedia.org/wiki/Fragment_identifier#Proposals

However, may top sites do not have id attributes, at least not with their header elements, like for example

has almost no id attributes. This makes the HTML look clean and tidy, but much less navigable.

Why is this (these days) and what to do about it? Is there another way to point a browser to a specific portion of a potentially large page?



Answers 1


The ID scrolling attribute using # links is very useful and you're right, it's probably underutilized. There are some things to consider however. If you're using the ID attribute for this purpose, then you'd want to include navigational # links on the page. And adding all of these links can cause for clutter. Wikipedia has them in their contents div, similar to that of a glossary. But not every site wants to dilute the content on their page by adding glossary style id links.

On top of that, historically, Google doesn't index # links in their search results. It would be high beneficial if they did. Many times when someone is searching for long tail question they are lead to a page that is mostly unrelated to the question with the answer hidden deep within the contents of the page. And it can be difficult to find the answer without reading all of its contents or using control+F for search.

Google has begun indexing # links from Wikipedia realizing just how useful this is. Though I don't think that Google has taken the time to do that for most sites.

Stackoverflow might not be using id links in their page, but they have now gotten indexing for specific answers. When you search Google for stackoverflow answers you'll often see snippet links for specific answers on the page. This was likely done with rich snippets or schema structure.

If you want portions of your page to be indexed by Google so that users can quickly navigate to that part of the page with a simple click from the SERP, you should take a look at rich snippets and schema. This can do that for you.

There are also other ways to navigate users to a page through URLs that would potentially be unadvised. For instance, you can have example.com/page and example.com/page/long-tail-keyword with a rel=canonical to example.com/page. When a user visits example.com/page/long-tail-keyword it can 302 redirect the user to example.com/page#keyword. You could also use file_get_contents on example.com/page#keyword in example.com/page/long-tail-keyword.

Other methods would be to use javascript and jquery that scrolls to the portion of the page that you want the user to see with the window.onload command.

michael d
michael d
February 23, 2018 21:20 PM

Related Questions



How to go through Wikipedia articles using arrows?

Updated March 06, 2018 23:04 PM