Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
644 views
in Technique[技术] by (71.8m points)

schema.org - Why does Google Testing Tool use the "id" attribute to generate a URL for the Microdata item?

I'm using some Microdata to describe a blog post, and I'm surprised by the value return for Schema.org’s BlogPosting by the Google Developers Testing Tool.

I would have expected it to be the itemprop url, not a merge of the website URL and the item id.
Am I doing something wrong, or is it only a Google display issue?

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

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

  BlogPosting:    http://www.example.com/foobar
  url:            http://www.example.com/realone
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

This is strange.

It’s definitely not conforming to the Microdata Note. Apart from Microdata’s itemref attribute, HTML5’s id attribute has no special meaning in Microdata.

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

My guess is that they are (probably unintentionally) handling HTML5’s id attribute the same way as Microdata’s itemid attribute. If using itemid instead of id in your example, Google’s Testing Tool output is the same, but this time correct.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...