Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

META tags that sit within HEAD of a webpage. What difference it makes when using microdata in them and outside of HEAD of webpage? Let's take for example "datePublished" property. Instead of hunting every time for text in content, why not just implement it within HEAD with META?

According to Google's structured data testing tool if certain microdata is presented for search engines, then it also must be present on webpage's content, otherwise such misleading practice will result in penalty. Even if that's the case, implementing within META will save us time and eye strain when wanting to wrap microdata around piece of content.

I will now explain about custom tag. I don't know about it being custom but I have seen tags like "time" where microdata code looked like this:

<time itemprop="datePublished">YYYY-MM-DD</time>
<text itemprop="datePublished">YYYY-MM-DD</text>

Are TIME and TEXT custom made up tags or they are elements that belong somewhere? Can I customize these for my needs?

Thanks

share|improve this question

3 Answers 3

You can use a <meta> element with itemprops for content which doesn't appear in a format you could otherwise mark up. This is described by Schema.org as "missing and implicit information".

I'm not aware of any reason why you can't apply this principle to any data you wish to describe with microdata, though if your HTML is well structured applying it to the actual elements shouldn't be that onerous and, in my view, is probably more logical and expedient.

<time> is not a "made up" element, but <text> would appear to be. You'd probably need to describe what sort of customisation you mean, but in practice what matters is how browsers, search engines, etc., interpret an element.

share|improve this answer
    
Can't see RDFa data there –  Boris_yo May 28 at 7:38
    
@Boris_yo I don't understand your point. The question is expressly about microdata. –  GDav May 28 at 13:25
    
Sorry, this question wasn't meant to be here but I am still wondering what is the difference between both formats. –  Boris_yo May 28 at 15:34

There are different standards for microdata. The word microdata just means that data has been embedded in the page. When you start using microdata you must reference which standard you are using with the itemtype attribute.

For example;

<div itemtype="http://schema.org/WebPage">

This itemtype property defines the microdata format for all the children of that <div>. If you are using the schema.org standard, then data is defined using a heirarchy of types starting with the base type Thing.

You can see a list of the different types here: http://schema.org/docs/full.html

I will now explain about custom tag. I don't know about it being custom but I have seen tags like "time" where microdata code looked like this:

The microdata set on the <time> tag is only valid if there is a parent DOM element that defines the itemtype. That will tell you what microdata standard is being used. Depending upon that type I can't tell you if it's a valid or invalid microdata format.

Are TIME and TEXT custom made up tags or they are elements that belong somewhere? Can I customize these for my needs?

Custom tags only work in XHTML and HTML5. In HTML5 unknown tags are rendered as display:block. When you create custom tags and view that HTML in non-HTML5 it will be ignored by the browser as display: none.

Microdata has nothing to do with custom tags. You can use microdata attributes and attach data to that tag, but it has no impact on how that tag is handled by the browser. This is true for all microdata attributes.

I would assume that Google indexes microdata on custom tags if the document type is XHTML. I don't see anyone reason for it to ignore the data.

META tags that sit within HEAD of a webpage. What difference it makes when using microdata in them and outside of HEAD of webpage?

Microdata in the <head> section of a webpage defines data that is for the scope of the entire page. You might want to define that the current page is a CollectionPage in the header, and then define a bunch of <div> tags as CreativeWork objects.

According to Google's structured data testing tool if certain microdata is presented for search engines, then it also must be present on webpage's content, otherwise such misleading practice will result in penalty.

This is one of those ambiguous guidelines by Google, and I've read the same thing on their site.

Here's how to clarify what they are talking about:

  • You can include microdata in your page header. If that works for you. It is completely valid and correct usage of the microdata standard.
  • Google will not display microdata from the header in it's search results. It's not visible to the user.
  • Google could penalize you for putting in microdata that does not represent what is on the page (i.e. Google does some magic processing to see if you are trying to trick them).
  • Google will index microdata that is defined as attributes on visible DOM elements in the body of a page.
  • Google will not tell you when, how or why they will use the microdata. I have microdata on several websites, and Google has never used it. Microdata appears in search results as a sidebar to the right of the results (i.e. search for a popular movie or actor).

There are other search engines out there that support microdata. These crawlers are not as strict as Google.

For example Yandex will index microdata found in embedded JSON-LD objects.

Try validating your microdata using their tool. I find it more accurate than Google's testing tools.

http://webmaster.yandex.com/microtest.xml

share|improve this answer

Microdata can be used on any HTML5 element.
So when you check HTML5 (resp. its Editor’s Draft), you’ll see that a time element is defined, but there is no text element.

From a Microdata perspective, it doesn’t make any difference if you use it in the head or in the body. Both ways are possible and valid. So these two snippets will generate the same Microdata name-value pairs:

<!-- snippet A -->
<head itemscope itemtype="http://schema.org/Person">
  <meta itemprop="name" content="John Doe" />
  <link itemprop="url" href="http://john.example.com/" />
</head>
<!-- snippet B -->
<body itemscope itemtype="http://schema.org/Person">
  <div itemprop="name">John Doe</div>
  <a itemprop="url" href="http://john.example.com/">Link</a>
</head>

It won’t be possible in every case to use the head element only, as you can’t add a grouping element (like div); i.e., adding Microdata for several different items is not possible in head.

But note that you can also use link/meta in the body, if used for Microdata:

<body>
  <p>Hi, I’m John Doe and this is <a href="http://john.example.com/">my website</a>.</p>
  <div class="hidden" itemscope itemtype="http://schema.org/Person">
    <meta itemprop="name" content="John Doe" />
    <link itemprop="url" href="http://john.example.com/" />
  </div>
</body>

While this may sometimes be easier to implement, it often makes sense to "couple" the Microdata with the visible content, as you don’t have to duplicate the content, and it’s easier to understand, and falling out of date will be noticed earlier.

All that said, Microdata consumers can do what they want. For example, a search engine like Google can of course decide that they won’t parse "hidden" Microdata.

… which would be stupid if this would be a hard rule, as there are for example Schema.org properties that can’t necessarily be specified somewhere else than in a meta/link element, for example the itemListOrder property on non-English pages (as those pages typically don’t want to contain an English "Ascending"), or the additionalType property (as it wouldn’t make sense for users to have a clickable link to vocabulary classes).

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.