Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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
like image 456
user3074069 Avatar asked Apr 07 '15 12:04

user3074069


People also ask

What is the use of microdata in HTML?

Microdata is an attempt to provide a simpler way of annotating HTML elements with machine-readable tags than the similar approaches of using RDFa and classic microformats. At a high level, microdata consists of a group of name-value pairs. The groups are called items, and each name-value pair is a property.

Why should you have microdata on your site?

The microdata tags can help your site get indexed and ranked more accurately, and the resulting rich snippets can help your site stand out from others on the results page and drive more traffic to you.

What is website microdata?

Microdata. An open-community HTML specification used to nest structured data within HTML content. Like RDFa, it uses HTML tag attributes to name the properties you want to expose as structured data. It is typically used in the page body, but can be used in the head.

What is schema in a URL?

LAST UPDATED: MAY 31, 2022. URL schema is used as an identifier in launching applications and performing a set of commands in iOS devices. The schema name of a URL is the first part of a URL. (e.g. schemaname:// ). For web pages, the schemas are usually http or https.


1 Answers

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.

like image 136
unor Avatar answered Dec 12 '22 12:12

unor