Rectangle 27 0

schema.org The correct approach to markup "keywords" of a blog post by using HTML5 and Microdata?


<article itemscope itemtype="http://schema.org/BlogPosting">

  <footer>
    <ul itemprop="keywords">
      <li><a href="/tags/foo" rel="tag">foo</a>,</li>
      <li><a href="/tags/bar" rel="tag">bar</a></li>
    </ul>
  </footer>

</article>
<div xmlns:ctag="http://commontag.org/ns#" rel="ctag:tagged">
   NASA's <a typeof="ctag:Tag" 
             rel="ctag:means"
             href="http://rdf.freebase.com/ns/en.phoenix_mars_mission"
             property="ctag:label">Phoenix Mars Lander</a> has deployed its robotic arm. 
</div>
<div>Tags: <a href="/tags/foo" rel="tag">foo</a>, <a href="/tags/bar" rel="tag">bar</a></div>
<div>Tags: <span itemprop="keywords"><a href="/tags/foo" rel="tag">foo</a>, <a href="/tags/bar" rel="tag">bar</a></span></div>
<dl>
  <dt>Tags</dt>
  <dd><a href="/tags/foo" rel="tag">foo</a></dd>
  <dd><a href="/tags/bar" rel="tag">bar</a></dd>
</dl>
<ul itemprop="keywords">
  <li><a href="/tags/foo" rel="tag">foo</a>,</li>
  <li><a href="/tags/bar" rel="tag">bar</a></li>
</ul>
<ul>
  <li><a href="/tags/foo" rel="tag">foo</a></li>
  <li><a href="/tags/bar" rel="tag">bar</a></li>
</ul>
ctag:Tag
ctag:label
ctag:means
ctag:tagged
tag

(Attention: tag is a Microformat, too, but it has a different definition: You may only use specially crafted URLs for the Microformat tag.)

@IanY.: I was under the impression that your last sentence ("Is there a common consensus on how the keywords of a blog post should be markuped by using HTML5 and Microdata?") refers to "keywords" in general. You are not restricted to use the schema.org vocabulary in Microdata, so I mentionend Common Tag and MOAT as you could use them instead of or in combination with the schema.org vocabulary.

@IanY.: Well, yes, but the property name doesnt have any "meaning", so you should simply ignore that. There is a proposal to change some schema.org properties from plural to singular. However, for keywords it says that its "not grammatically plural".

@IanY: I updated the schema.org section regarding multiple keywords properties. I think you have to use multiple ones.

A div with comma-separated a elements would work also, of course:

A footer typically contains information about its section such as who wrote it, links to related documents, copyright data, and the like.

An ontology that let users define relationships between Tag objects and URIs of Semantic Web resources

And if a Microdata property is used on an <a> or an <img> tag, then its values is sourced by the href or the src attribute. So your second example (the one using <span>) is the correct way to source text values.

As keywords expects a comma-separated list of tags, dl cant be used (unless the dl contains nothing else than tags).

Common Tag is a (RDF) vocabulary for tagging. In contrast to Schema.orgs keywords property it uses URIs for tags, not text only.

CreativeWork defines the property keywords (BlogPosting inherits it):

Example from their Quick Start Guide in RDFa:

Id go with the dl when you also have other metadata to list, e.g. the author, publication date, etc.

If using a div, youd need to add another div/child so that the label "Tags:" gets not interpreted as tag itself:

If using it like that, you have to make sure that the ul contains no other non-tag text.

If your tags are more like categories (controlled vocabulary instead of free tagging), you could use the link type category (possibly in combination with tag).

Instead of ctag:Tag you could use the class ctag:AuthorTag (which means that its tagged by the content author).

It expects plain text, so theres no way to provide the tag URLs in Schema.org.

Keywords or tags used to describe this content. Multiple entries in a keywords list are typically delimited by commas.

Note that this link type can only be used on single post pages as the tag always applies to the whole page.

So for the typical blog tags, youd go the following way (possibly in addition to meta-keywords).

Thanks for the long article, while honestly it doesn't really provide much help. What I want to know is a semantically correct way to markup keywords, by using HTML5 and Microdata. I know the Microformats rel="tag" thing, yet both of it and RDF are not the main point at here. As mentioned in the question, the keywords property of Microdata is in plural form, so wouldn't it be weird to use it on a single word?

The list should be part of a footer element (inside the article if you use one for your blog post):

The meta element with the name value keywords offers a way to specify keywords that apply to the whole page. These keywords consist of text only, so you cant use URIs.

The tag keyword indicates that the tag that the referenced document represents applies to the current document.

There is also the MOAT vocabulary, which stands for "Meaning Of A Tag". Unfortunately, their website seems to be gone (?).

Update: The definition of Schema.orgs keywords property changed. Now it makes clear that it expects multiple tags, and that they should typically be comma-separated.

With an ul, it could look like this in Microdata:

You might use a ul or a dl:

tl;dr: If you want to use a ul element for your tags, using Schema.orgs keywords property could look like this in Microdata:

Note