Is Google indexing HTML custom data attributes?

岁酱吖の 提交于 2019-11-30 17:31:19

问题


I'm building an AJAX based portfolio module using pushState / hash bangs and as I'm ruling out browsers without JavaScript the only thing that concerns me is how limited the HTML custom data attributes are when it comes to SEO.

For example, using the code below:

<ul class="gallery" data-anchor="/photography/example/" data-title="Example"></ul>

Will the data-title be indexed, i.e. will that text content be gathered by Google? Or would I need to include a header tag in or around the list as a descriptive complement? The data-title is meant to be used as a new window title once the user clicks on that particular gallery.


回答1:


No, it won't be indexed. The attribute itself will be cached with the page, but Google has no context of what the attribute or the value means, so it is meaningless to search engines.




回答2:


You should assume that all HTML content can be used to some extent by a search engine.

However, I would say almost invariably that visible content will be weighted much more heavily than invisible content. Even if Google does use data attributes in its weighting algorithm, you should make the content visible to users too



来源:https://stackoverflow.com/questions/10174505/is-google-indexing-html-custom-data-attributes

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!