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.)
Related
I've found this type on Schema.org: ExerciseGym
It doesn't have any examples with it and I'm confused as to how to use it because it seems to inherit properties from other schemas. This one is more specific to the business so ideally I'd like to use it.
It says "properties from LocalBusiness". I have used LocalBusiness before, and it contains good examples. Should I combine LocalBusiness and ExerciseGym and Person as I would like to list the personal trainers of the gym as employee but it says employee is Person?
So is something like this the right way to do this:
<div class="contact" itemscope itemtype="http://schema.org/ExerciseGym https://schema.org/LocalBusiness https://schema.org/Person" itemprop="employee">
<div class"name" itemprop="name">John Doe Does</div>
...
</div>
A type "includes" all its parent types. An ExerciseGym is also a SportsActivityLocation, a LocalBusiness, an Organization, a Place, and a Thing.
So you don’t have to specify ExerciseGym and LocalBusiness, specifying ExerciseGym is sufficient.
If you specify Person in addition to ExerciseGym, you are conveying: There is something that is a person and a gym. This is of course not want you want to say. To add an employee, you need two separate items: the gym and the person. In Microdata, an item is created with the itemscope attribute.
Example with an ExerciseGym that has two employees:
<div itemscope itemtype="http://schema.org/ExerciseGym">
<div itemprop="employee" itemscope itemtype="http://schema.org/Person">
<span itemprop="name">John</span>
</div>
<div itemprop="employee" itemscope itemtype="http://schema.org/Person">
<span itemprop="name">Alice</span>
</div>
</div>
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.
I have a table containing some properties of a city. The city is part of a larger area, so I want to add the property containedIn. However, I also want to indicate the type of that area, like "region", "province", or "state", so I am trying to add additionalProperty to these areas. I am very confused about how to do this correctly and efficiently.
This is what I have tried, but Google Structured Data Testing Tool gives two/duplicate items (and two name properties). I want to add both containedIn and additionalProperty to San Juan and San Pablo, but it seems the property name is recognized by both containedIn and additionalProperty, so I do not know how to fix it:
<div itemscope itemtype='http://schema.org/City'>
<h1 itemprop='name'>San Pedro</h1>
<table>
<tr itemprop='additionalProperty' itemscope itemtype='http://schema.org/PropertyValue'>
<td itemprop='name'>Type</td>
<td itemprop='value'>city</td>
</tr>
<tr itemprop='additionalProperty containedIn' itemscope itemtype='http://schema.org/PropertyValue http://schema.org/AdministrativeArea'>
<td itemprop='name'>State</td>
<td itemprop='value'><a itemprop='url' href='#.html'><span itemprop='name'>San Juan</span></a></td>
</tr>
<tr itemprop='additionalProperty containedIn' itemscope itemtype='http://schema.org/PropertyValue http://schema.org/AdministrativeArea'>
<td itemprop='name'>Region</td>
<td itemprop='value'><a itemprop='url' href='#.html'><span itemprop='name'>San Pablo</span></a></td>
</tr>
</table>
</div>
Display in Google’s SDTT
The display in Google’s SDTT appears to be correct for the Microdata you provide:
If you use multiple properties to add an item, SDTT displays this item once for every property.
It’s just the way they decided to display it. They could as well have decided to display something like this instead, but they didn’t:
additionalProperty, containedIn
#type PropertyValue
#type AdministrativeArea
If you use multiple properties to add an item, and/or if this item has multiple types, you don’t add multiple/different items, it’s one and the same item.
It wouldn’t make sense that the name is only for one of the multiple types, or only for the item added by one of the multiple properties. There is only one item, with one set of properties, with multiple types, added by multiple properties.
Meaning
As far as I understand your data, you have a city (San Pedro) which is part of two administrative areas (San Juan, San Pablo).
I’m not sure it makes sense to model it so that the AdministrativeArea is also a PropertyValue. It seems to make more sense to apply the additionalProperty PropertyValue to the AdministrativeArea.
It’s not that easy within a table, so for the sake of this example, I’m using div:
<div itemprop='containedIn' itemscope itemtype='http://schema.org/AdministrativeArea'>
<a itemprop='url' href='#.html'><span itemprop='name'>San Juan</span></a>
<div itemprop='additionalProperty' itemscope itemtype='http://schema.org/PropertyValue'>
<meta itemprop='name' content='State'>
<meta itemprop='value' content='San Juan'>
</div>
</div>
Remark: using additionalType instead of additionalProperty for the "type of area"
Using additionalProperty PropertyValue to specify the type of the area is possible, but unusual. Typically actual types are used for such a purpose.
Find a type that represents the concept (e.g. "Region"), or create your own, and add it in addition to the most specific Schema.org type you can find.
In Microdata, the itemtype attribute can only take types from the same vocabulary, so you have to use the additionalType property:
<div itemprop='containedIn' itemscope itemtype='http://schema.org/AdministrativeArea'>
<a itemprop='url' href='#.html'><span itemprop='name'>San Juan</span></a>
<link itemprop="additionalType" href="http://example.com/some-vocabulary/Region">
</div>
And for the city: by using Schema.org’s City type, you already convey that it’s a city, so your additionalProperty (with type=city) seems to be superfluous. But if you want to convey some other type, you can use the same method with additionalType here, too.
According to the documentation (http://schema.org/Thing), the item type Thing cannot include a Place.
The users will be asked to add content that does not have a specific type, therefore everything falls back to Thing. So, suppose the following example. This is want I would like to have, but seems to be invalid. Is there a workaround to fix it?
<div itemscope itemtype="http://schema.org/Thing">
<span itemprop="name">Eiffel Tower</span>
<span itemprop="description">Sample description</span>
<div itemscope itemtype="http://schema.org/Place">
<div itemscope itemtype="http://schema.org/PostalAddress">
<span itemprop="streetAddress">Sample address</span>
</div>
</div>
</div>
Your example snippet is valid.
Simply nesting elements with itemscope/itemtype has no effect on the parsed Microdata. You have to use the itemprop attribute if you want to associate/relate the items.
So in your example, you have three items (Thing, Place, PostalAddress) which are not related in any way.
If your question is, "Has Thing a property which allows a value of Place?", the answer is no, there is no such property.
The best solution would be to have the user choose what "type" of thing they are submitting and map those to schema.org types.
E.g. if you had a drop-down list on the form they use to submit listing "CD", "Event", "Place", etc. and use the value from that form field to set the value of the main itemtype.
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>