Do you put Schema Microdata meta tags in the html body?

I searched the Internet and stackoverflow for a long time to answer this question, and I found links that say that you should not put meta tags in the body:

  • Using HTML5 + Microdata <meta> tag in <body>
  • body metadata transfer
  • Body meta tags

while schema.org clearly shows that meta tags are inserted directly into the body of http://schema.org/AggregateRating

Just look at the example that is posted there.

Customer reviews: <div itemprop="reviews" itemscope itemtype="http://schema.org/Review"> <span itemprop="name">Not a happy camper</span> - by <span itemprop="author">Ellie</span>, <meta itemprop="datePublished" content="2011-04-01">April 1, 2011 <div itemprop="reviewRating" itemscope itemtype="http://schema.org/Rating"> <meta itemprop="worstRating" content = "1"> <span itemprop="ratingValue">1</span>/ <span itemprop="bestRating">5</span>stars </div> <span itemprop="description">The lamp burned out and now I have to replace it. </span> </div> <div itemprop="reviews" itemscope itemtype="http://schema.org/Review"> <span itemprop="name">Value purchase</span> - by <span itemprop="author">Lucas</span>, <meta itemprop="datePublished" content="2011-03-25">March 25, 2011 <div itemprop="reviewRating" itemscope itemtype="http://schema.org/Rating"> <meta itemprop="worstRating" content = "1"/> <span itemprop="ratingValue">4</span>/ <span itemprop="bestRating">5</span>stars </div> <span itemprop="description">Great microwave for the price. It is small and fits in my apartment.</span> </div> 

If you saved the meta tags in <head> , how would you relate these two dates to their reviews? <meta itemprop="datePublished" content="2011-04-01"> <meta itemprop="datePublished" content="2011-03-25">

This is confusing, and I would like to know how to do it right.

+54
html html5 microdata
Apr 23 '12 at 11:00
source share
6 answers

If the meta element

  • has an itemprop attribute and a content attribute, and
  • does not have a name attribute, an http-equiv attribute, and a charset attribute,

then its value is meta in body . (If the value is a URL, you should use link instead .)

Why? Because the Microdata specification modifies HTML5 .

(Note that RDFa also modifies HTML5 by allowing meta in the body in some cases.)




If you saved meta tags in <head> , how would you relate these two dates to their reviews?

You can 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 accepts a list of id values, separated by spaces, so you can even refer to two or more elements. Just add the id all the items (containing the itemprop attributes) that should be added to the item in your itemref attribute, for example: itemref="date author rating" .

+66
Mar 14 '14 at 20:54
source share

What can I read from whatwg.org to use correctly in the 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 blog to specify the datePublished and dateUpdated properties. Googles Rich Snippets testing tool tells me this correctly, and w3c checks the code.

+8
Apr 28 2018-12-12T00:
source share

Remember also that you can completely avoid HTML markup and use JSON-LD markup , which is completely contained in <head> anywhere in your HTML document (even dynamically inserted!) , For example:

 <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> 

look at the examples in schema.org , they usually contain JSON examples, for example, https://schema.org/Restaurant .

Here is another good article about it http://www.seoskeptic.com/json-ld-google-knowledge-graph-schema-org-seo/

+5
May 13 '15 at 4:31
source share

You can use:

 <meta itemprop=""> 

in the body of the page to make semantic markup for schema.org, which is machine readable (e.g. robots for SEO), even if you don't want to display the actual text (e.g. product name) on the page.

see http://schema.org/docs/gs.html#advanced_missing

Sometimes a web page has information that would be valuable for marking but the information cannot be marked because of how it appears on the page. Information can be transmitted on an image (for example, an image used to represent a 4 out of 5 rating) or a Flash object (for example, the duration of a video clip), or it can be implied, but not explicitly indicated on the page (for example, price currency).

+4
Aug 25 2018-12-12T00:
source share

When I first worked with schema.org microdata, I added meta tags in the main tag of my web page, but when I launched this page against the Google Rich Snippets Testing Tool , the data was not extracted. Then I moved the meta tags to the body of the page and the data was shown as retrieved.

+3
Apr 24 2018-12-12T00:
source share

I do this:

 <meta id="md_course" itemprop="course" name="course" content="..."/> <meta id="md_lang" itemprop="language" content="eng"/> <title id="md_title" itemprop="title" >Motivation and Course Overview</title> </head> <body itemscope itemtype=".../Presentation" itemref="md_course md_lang md_title md_field"> 
+2
Apr 23 '12 at 11:13
source share



All Articles