Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is Google indexing HTML custom data attributes?

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.

like image 457
Staffan Estberg Avatar asked Apr 16 '12 12:04

Staffan Estberg


People also ask

What are custom data attributes in HTML?

Custom Data Attributes allow you to add your own information to tags in HTML. Even though the name suggests otherwise, these are not specific to HTML5 and you can use the data-* attribute on all HTML elements. The data-* attributes can be used to define our own custom data attributes.

Can HTML use custom attributes?

If you want to define your own custom attributes in HTML, you can implement them through data-* format. * can be replaced by any of your names to specify specific data to an element and target it in CSS, JavaScript, or jQuery.

Why is the data attribute used in HTML if needed Google it?

The data-* attribute is used to store custom data private to the page or application. The data-* attribute gives us the ability to embed custom data attributes on all HTML elements.

Which tag is used for data attribute in HTML?

HTML <data> Tag.


2 Answers

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.

like image 63
saluce Avatar answered Sep 24 '22 23:09

saluce


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

like image 25
Gareth Avatar answered Sep 26 '22 23:09

Gareth