html5 - Adding schema.org tags to a site's header: how and which schema? -
i have website provides transportation services, not products (with mean don't sell widgets of brand, other model...; provide 1 kind of transportation service). i'm bit unclear how should add schema.org microdata site, looked @ ryanair doing (since our product resembles theirs) , copied markup (changing our company's name, obviously). markup such:
<meta content="ie=edge" http-equiv="x-ua-compatible"/> <meta content="text/html; charset=utf-8" http-equiv="content-type"/> <meta content="#22356b" name="theme-color"/> <meta content="book cheap flights direct @ official ryanair website europe's lowest fares. allocated seating , more available online" name="description"/> <meta content="summary" name="twitter:card"/> <meta content="@ryanair" name="twitter:site"/> <meta content="cheap flights | cheap flights europe | ryanair" name="twitter:title"/> <meta content="book cheap flights direct @ official ryanair website europe's lowest fares. allocated seating , more available online" name="twitter:description"/><meta content="@ryanair" name="twitter:creator"/> <meta content="/static/images/seo/seo-logo-200.png" name="twitter:image:src"/> <meta content="https://www.ryanair.com" name="twitter:domain"/> <meta itemtype="http://schema.org/product" itemscope="itemscope"/> <meta content="cheap flights | cheap flights europe | ryanair" property="og:title"/> <meta content="cheap flights | cheap flights europe | ryanair" itemprop="headline"/> <meta content="book cheap flights direct @ official ryanair website europe's lowest fares. allocated seating , more available online" property="og:description"/> <meta content="book cheap flights direct @ official ryanair website europe's lowest fares. allocated seating , more available online" itemprop="description"/> <meta content="http://www.ryanair.com/en/" property="og:url"/> <meta content="/static/images/seo/seo-logo-200.png" property="og:image"/> <meta content="/static/images/seo/seo-logo-200.png" itemprop="image"/> <meta content="article" property="og:type"/> <meta content="ryanair" property="og:site_name"/> <meta content="" property="fb:admins"/><link href="https://plus.google.com/" rel="publisher"/> <meta content="index,follow" name="robots"/> <meta content="noydir" name="slurp"/> <meta content="noodp" name="robots"/> <meta content="copyright ryanair.com 2014" name="dcterms.rightsholder"/>
and yet, google webmaster tools shows me error in following line:
<meta itemtype="http://schema.org/product" itemscope="itemscope" />
saying needs "name" property.
how should add this? examples i've looked @ situations have multiple products , need mark each 1 of them. also, examples i've seen adding markup in webpage's body, not in header. 1 correct?
update: below answer not correct. is possible express every microdata within head
element, there no need parent item on head
or html
element. example, see snippet my comment on related schema.org issue, uses style
element create top-level-item:
<head> <style itemscope itemtype="http://schema.org/thing" itemref="i1a i1b"></style> <meta id="i1a" itemprop="name" content="top-level item 1" /> <meta id="i1b" content="" itemprop="image" itemscope itemtype="http://schema.org/imageobject" itemref="i1b-1a i1b-1b" /> <meta id="i1b-1a" itemprop="name" content="nested item 1" /> <link id="i1b-1b" itemprop="contenturl" href="image.png" /> </head>
not practice, , becomes chaotic because of needed itemref
/id
values, it’s valid.
from snippet included in question, these elements contain microdata:
<meta itemtype="http://schema.org/product" itemscope="itemscope"/> <meta content="cheap flights | cheap flights europe | ryanair" itemprop="headline"/> <meta content="book cheap flights direct @ official ryanair website europe's lowest fares. allocated seating , more available online" itemprop="description"/> <meta content="/static/images/seo/seo-logo-200.png" itemprop="image"/>
this code not valid, , not doing want achieve.
if want provide microdata in head
element (which wouldn’t make sense, let’s pretend) need element can have child elements. otherwise can’t create top-level microdata item.
the candidate head
element itself, provide one item in head
, , have no properties take item value. properties use link
elements (if value uri) , meta
elements (if value not uri).
so have (omitting headline
property, because it’s not allowed product
):
<head itemscope itemtype="http://schema.org/product"> <meta content="…" itemprop="description"/> <link href="…" itemprop="image"/> </head>
that’s pretty limited. so, if want use microdata (or rdfa), want make use of whole document (html
, head
and body
). whole point of using microdata/rdfa make use of existing content, without having duplicate it. if don’t want "annotate" existing content, use json-ld , provide properties in script
element, e.g., in head
.
about missing name
property: if google’s structured data testing tool says property missing, means google won’t do markup if it’s missing. not mean code invalid without it, schema.org has no required properties.
Comments
Post a Comment