I want to link to a specific page for a content author but my RDFa seems to get misinterpreted.
In the example below I want to define a Photograph with an author property, which itself is Person with a name. And I want the name to be a link to a page with all of the contributor's content.
<div typeof="Photograph" resource="/photo/5" vocab="http://schema.org/">
<p property="author" typeof="Person">
Contributed by:
<a href="/contributor/5" title="Contributions from Weston">
<span property="name">Weston</span>
</a>
</p>
</div>
But trying to validate I get the following Turtle format results from the W3C Validator
#prefix ns1: <http://www.w3.org/ns/rdfa#> .
#prefix ns2: <http://schema.org/> .
<> ns1:usesVocabulary ns2: .
</contributor/5> ns2:name "Weston" .
</photo/5> a ns2:Photograph;
ns2:author [ a ns2:Person ] .
Which looks to me like the name is not associated with the Person, but with the resource /contributor/5.
You need to have the href attribute (the one containing your Person URI) in the same HTML element as property and typeof, like this:
<div typeof="Photograph" resource="/photo/5" vocab="http://schema.org/">
<p>
Contributed by:
<a property="author" typeof="Person" href="/contributor/5" title="Contributions from Weston">
<span property="name">Weston</span>
</a>
</p>
</div>
For testing your markup, I highly recommend http://rdfa.info/play/ for live debugging :)
As you noticed the href causes describing a new resource.
There is another possibility to solve it: keep your code like it is and simply add an empty property attribute to the a element:
<div typeof="Photograph" resource="/photo/5" vocab="http://schema.org/">
<p property="author" typeof="Person">
Contributed by:
<a href="/contributor/5" title="Contributions from Weston" property="">
<span property="name">Weston</span>
</a>
</p>
</div>
This will be the turtle result:
#prefix ns1: <http://www.w3.org/ns/rdfa#> .
#prefix ns2: <http://schema.org/> .
<> ns1:usesVocabulary ns2: .
</photo/5> a ns2:Photograph;
ns2:author [ a ns2:Person;
ns2:name "Weston" ] .
I found this solution in some official guides like the HTML Data Guide:
http://www.w3.org/TR/html-data-guide/
Related
I'd like to mark my list of acronyms/abbreviations in my glossary of my website with Schema.org (using Microdata).
Which type of Schema.org is the right one for that?
I can't find any related type in the full list on schema.org.
The type DefinedTerm (which is currently in Pending, so it’s subject to change) is suitable for a
word, name, acronym, phrase, etc. with a formal definition
In a glossary, you would use the name property for the term, and the description property for what the term stands for.
<p itemscope itemtype="https://schema.org/DefinedTerm">
<span itemprop="name">SO</span>:
<span itemprop="description">Stack Overflow</span>
</p>
Or with semantic markup:
<dl>
<div itemscope itemtype="https://schema.org/DefinedTerm">
<dt itemprop="name"><dfn><abbr>SO</abbr></dfn></dt>
<dd itemprop="description">Stack Overflow</dd>
</div>
</dl>
(For the whole glossary, you could use the type DefinedTermSet, and add each entry with the property inDefinedTermSet.)
Based on the Microdata example in http://schema.org/HowTo and extrapolating syntax from the Microdata vs RDFa example in http://schema.org/hasOfferCatalog (there seem to be so few actual examples of RDFa to find?), I put together something like so:
<main vocab="http://schema.org/" typeof="HowTo">
<h1><span property="name">How to do the Hokey Pokey</span></h1>
<ol property="steps">
<li property="itemListElement" typeof="HowToStep">
<img alt="step 1" src="step1.jpg" align="left">
<p property="itemListElement" typeof="HowToDirection">
put your left hand in</p></li>
<li property="itemListElement" typeof="HowToStep">
<img alt="step 2" src="step2.jpg" align="left">
<p property="itemListElement" typeof="HowToDirection">
put your left hand out</p></li>
But, when put into Google's Structured Data Testing Tool, I get:
The property itemListElement is not recognized by Google for an object of type HowTo.
Yandex's validator also says:
WARNING: http://schema.org/itemListElement field not specified in http://schema.org/HowTo
What am I doing wrong?
You missed to specify the HowToSection (or HowToStep) type as value for the steps property.
The Microdata example uses:
<div id="steps" itemprop="steps" itemscope itemtype="http://schema.org/HowToSection">
The equivalent RDFa would be:
<div id="steps" property="steps" typeof="HowToSection">
If you aren’t providing an ItemList/CreativeWork value for the steps property, you are providing a Text value (this is what you are doing in your example markup). But you can’t add properties (like itemListElement) to a Text value.
Could anyone tell me what if the EducationEvent has not got startDate and endDate, because it is not known yet? If I set an empty value for it ($startIso is an empty string):
<meta itemprop="startDate" content="{{ $startIso }}" />
I get:
Error: Missing required field "dtstart".` error message in validator.
Here’s the code:
<div itemscope itemtype="http://schema.org/EducationEvent">
<h1 class="columns">
<span itemprop="name">{{ $courseTypesDescription->course_type_name }}</span>
</h1>
<div class="dates columns">
<div class="row">
<div class="large-5 medium-6 columns">
#if ($start != "")
<meta itemprop="startDate" content="{{ $startIso }}" />
#endif
<i class="fa fa-calendar"></i>
<span class="text">Start: </span>
<span class="data"> #if ($start != "") {{ $start }} #else N/A #endif</span>
</div>
<div class="large-5 medium-6 columns end">
#if ($exam != "")
<meta itemprop="endDate" content="{{ $examIso }}" />
#endif
<i class="fa fa-pencil-square-o"></i>
<span class="text">Exam: </span>
<span class="data"> #if ($exam != "") {{ $exam }} #else N/A #endif </span>
</div>
</div>
</div>
<article class="description columns" itemprop="description">
{{ $courseTypesDescription->course_type_desc }}
</article>
</div>
I agree with unor's answer but I would recommend you to use http://schema.org/Event rather than using http://schema.org/EducationEvent because Google is currently showing rich snippets on organic search for only those categories which are their in the Help Center document-
https://support.google.com/webmasters/answer/99170?hl=en
What you are implementing is a sub category of Event schema. You are correct in your way as you must be trying to specify the kind of events you have on your website. But as per my experience Google is not showing snippets for all available sub categories present on schema.org like schema.org/EducationEvent
Schema.org is format(syntax) of rich snippet markup implementation and apart from that schema.org has long list of Structured Data categories and Sub Categories. For all of those categories(http://schema.org/docs/full.html) Google doesn't show snippets. Only those appear with rich snippets on Google which are present in their official help center document as mentioned above.
This will increase the possibility to earn rich snippets for your website.
Your usage of Microdata with the Schema.org vocabulary is correct (if you make sure to remove the properties with empty values). Schema.org doesn’t define any required properties.
It’s just that Google Search, according to their documentation, seems to require the startDate property for displaying the Events Rich Snippet (and also location if it’s a single event, and url if your page lists several events).
If you don’t provide it, and if Google’s docs are correct, you won’t get (the chance for displaying) a Rich Snippet for your event. They probably require a future start date because they don’t like to display Rich Snippets for past events.
That doesn’t mean that you should omit the markup. It can be useful for other consumers (even possibly from Google, unrelated to their Rich Snippets), and Google’s Rich Snippets guidelines might change in the future, allowing for other types of Event snippets.
I'm trying to markup an article and confused as to how to use the about property (from CreativeWork).
http://schema.org/about
My guess is that it can be used like this...
<p itemprop="about">Short text about the article...</p>
But on schema.org it says that the expected type is Thing so I'm not sure what I should be inserting inside the itemprop="about" tag; I can't find any examples of the about property in use.
Can anyone help and provide an example?
When using Microdata, the syntax would look like:
<p itemprop="about" itemscope itemtype="http://schema.org/Thing">
…
</p>
(Instead of Thing, you could use a more specific type.)
Now you can use properties for this Thing, for example giving it a name, sameAs to link to the corresponding Wikipedia page, and description for a short description:
<p itemprop="about" itemscope itemtype="http://schema.org/Thing">
<span itemprop="description">A <span itemprop="name">Bee</span> is a flying insect.</span>
<link itemprop="sameAs" href="http://en.wikipedia.org/wiki/Bee" />
</p>
I try to map the following html (it´s a small fce)..
<div>
<div data-hero="1">
<h1>
<!-- Headline -->
</h1>
<p>
<!-- Small Text -->
</p>
<p>
<a>
<span><!-- Button Text --></span>
</a>
</p>
</div>
</div>
Mapping is ok... But when i map the <span> i get a No content found div[1] div[1] p[2] a[1] span[1] error. The <a>-Tag is mapped outter so it should work..
What I try to achieve: Set a Text that is displayed in the <a>-tag, instead of the link target itself.
It´s a TYPO3 4.7 using the latest TemplaVoilà.
Why is that? Thanks in advance!
Edit
#biesior suggested this is not possible - so no i wrap a <span> into the <a>-tag via Typoscript.
Is there a chance to display a certain fields content in this <span> - speak: replacing the linktext, so that i can have a Click here for more ... instead of pageXY?
Btw: I use a linkfield and not the Rich-Text-Editor for setting the link.
You can not map any element nested in previously mapped element.
The fastest solution is mapping the A tag, and wrapping inserted text with <span>|</span> with TypoScript.