Do you put Schema Microdata meta tags in the html body?
If a meta
element
- has an
itemprop
attribute and acontent
attribute, and - has no
name
attribute, nohttp-equiv
attribute, and nocharset
attribute,
then it’s valid to have this meta
in the body
. (If the value is a URL, you must use link
instead.)
Why? Because the Microdata specification changes HTML5.
(Note that RDFa also changes HTML5 by allowing meta
in the body
in some cases.)
If you were to keep the
meta
tags in the<head>
, then how would you relate these two dates to their reviews?
You could use the itemref
attribute:
<!DOCTYPE html>
<html>
<head>
<title>Using itemref for meta in the head</title>
<meta itemprop="datePublished" content="2011-03-25" id="date">
</head>
<body>
<div itemscope itemtype="http://schema.org/Review" itemref="date">
<span itemprop="name">…</span>
</div>
</body>
</html>
itemref
takes a space-separated list of id
values, so you can even reference two or more elements. Just add the id
of all elements (containing itemprop
attributes) that should be added to the item to its itemref
attribute, e.g.: itemref="date author rating"
.
Remember also that it's possible to totally avoid HTML markup and use JSON-LD markup entirely contained in the anywhere in the HTML document (even dynamically injected!) like this:<head>
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "Restaurant",
"name": "Fondue for Fun and Fantasy",
"description": "Fantastic and fun for all your cheesy occasions",
"openingHours": "Mo,Tu,We,Th,Fr,Sa,Su 11:30-23:00",
"telephone": "+155501003333",
"menu": "http://example.com/menu"
}
</script>
have a look at the examples in schema.org, they usually contain JSON example markups like this https://schema.org/Restaurant.
Here is another good article about it http://www.seoskeptic.com/json-ld-google-knowledge-graph-schema-org-seo/
What I can read from whatwg.org it's correct to use in body: http://www.whatwg.org/specs/web-apps/current-work/multipage/semantics.html#the-meta-element
I use meta tags in the body of my blogg to specify the "datePublished" and "dateUpdated" properties. Googles Rich Snippets Testing Tool tells me it's correct and w3c validates the code.
You can use:
<meta itemprop="">
in the body of the page to do schema.org semantic markup that is machine readable (by robots, for SEO, for instance) even if you don't want to display the actual text (product name, for example) on the page.
see: http://schema.org/docs/gs.html#advanced_missing
Sometimes, a web page has information that would be valuable to mark up, but the information can't be marked up because of the way it appears on the page. The information may be conveyed in an image (for example, an image used to represent a rating of 4 out of 5) or a Flash object (for example, the duration of a video clip), or it may be implied but not stated explicitly on the page (for example, the currency of a price).