RDFa with schema.org blog schema

I'm having trouble figuring out if I did it right with RDFa and the schema.org blog type. My blog had a list of posts that looked like this:

<h2><a href="essays/why-orm-divides-us.html">Why ORM Divides Us</a></h2> <h2><a href="essays/heretic-calculus.html">A Heretical Calculus</a></h2> 

When trying to increase it using RDFa information, in particular Blog and BlogPosting , I came up with the following:

 <div vocab="http://schema.org/" typeof="Blog"> <h2 property="blogPosting" typeof="BlogPosting" resource="essays/why-orm-divides-us.html"> <a property="url" href="essays/why-orm-divides-us.html"> <span property="name">Why ORM Divides Us</span> </a> </h2> <h2 property="blogPosting" typeof="BlogPosting" resource="essays/heretic-calculus.html"> <a property="url" href="essays/heretic-calculus.html"> <span property="name">A Heretical Calculus</span> </a> </h2> ... 

As far as I can tell with the Google Rich Snippets Testing Tool, it looks like it parses correctly, but I can't say. I have two more attempts:

 <div vocab="http://schema.org/" typeof="Blog"> <h2 property="blogPosting" typeof="BlogPosting" resource="essays/why-orm-divides-us.html"> <a href="essays/why-orm-divides-us.html" property="name">Why ORM Divides Us</a> </h2> <h2 property="blogPosting" typeof="BlogPosting" resource="essays/heretic-calculus.html"> <a href="essays/heretic-calculus.html" property="name">A Heretical Calculus</a> </h2> ... <div vocab="http://schema.org/" typeof="Blog" rel="blogPosting"> <h2 typeof="BlogPosting" resource="essays/why-orm-divides-us.html"> <a property="url" href="essays/why-orm-divides-us.html"> <span property="name">Why ORM Divides Us</span> </a> </h2> <h2 typeof="BlogPosting" resource="essays/heretic-calculus.html"> <a property="url" href="essays/heretic-calculus.html"> <span property="name">A Heretical Calculus</span> </a> </h2> ... 

So, I ask for a few pieces of information:

  • How do you know if you have achieved compliance with one of these patterns?
  • Which of my alternatives is right, and why?
  • Why does it seem to me that you need to specify the resource directly when I find the link?
  • Why is the <a> tag so painted in the RDFa demo tool and Google Rich Snippets testing tool?
+4
source share
1 answer

Your first snippet is correct, and I would recommend using it. The second is incorrect because the = "name" property will target the href value, so do not use it. The third is also correct and uses the more advanced RDFa function, called a chain (via the rel attribute). This is great for use, if you prefer, Google understands that too.

  • I don’t know the official official copy of schema.org, but Google Rich Snippet will sometimes tell you something is wrong (not always). You can also validate your HTML + RDFa markup http://validator.w3.org/nu/ and http://www.w3.org/2012/pyRdfa/Validator.html .
  • your first and third are correct, the second is incorrect (see above). I would recommend the first one.
  • well, the link URL is used for two purposes: first, it is used to identify your object on the Internet, and it is also explicitly used for the url property, which is required for schema.org. Although the second property is specific to schema.org.
  • Something that Google adds on top of RDFa syntax, pure RDFa parser will not return href value and grouping. I think Google does this for convenience, but I agree that this can be confusing.
+4
source

Source: https://habr.com/ru/post/1433102/


All Articles