Why does the Google Testing Tool use the id attribute to create a URL for a Microdata element?

I use some Microdata to describe my blog post, and I am surprised at the return value for Schema.orgs BlogPosting using the Google Developers Testing Tool.

I would suggest that this is an itemprop url and not a merge of the website URL and the id element.
Am I doing something wrong or is it just a Google display issue?

 <div itemscope="itemscope" itemprop="blogPost" itemtype="http://schema.org/BlogPosting" id="foobar"> <a itemprop="url" href="/realone">real</a> </div> 

The value returned by https://developers.google.com/structured-data/testing-tool/ :

  BlogPosting: http://www.example.com/foobar url: http://www.example.com/realone 
+6
source share
1 answer

This is strange.

This is definitely not consistent with Note to Microdata . Besides the Microdatas itemref attribute, the HTML5 id attribute has no special meaning in Microdata.

If Google still wants to use the id value, it should at least generate a URL with a fragment identifier, i.e. http://www.example.com/#foobar .

I assume that they (perhaps inadvertently) handle the HTML5 id attribute in the same way as the Microdatas itemid attribute. If you use itemid instead of id in your example, the output of the Googles Testing Tool is the same, but this time correct.

+2
source

Source: https://habr.com/ru/post/984786/


All Articles