How to write valid opening hours with lunch break in schema.org with JSON-LD [duplicate] - schema.org

This question already has an answer here:
Including "siesta" in Schema.org OpeningHoursSpecification in JSON-LD
(1 answer)
Closed 1 year ago.
I was reading all posts around this topic here but couldn't find a solution.
I'm building a page for a business that has the following opening hours:
Monday-Friday 07:00 - 12:00 and 13:00 - 17:00 (1 hour lunch break)
I can't find a way to write this as valid JSON-LD for my schema.org markup. Google's rich results test tool is not accepting my ideas and on schema.org documentation I cannot find any examples for a case like that.
The standard valid code without the lunch break looks like this:
"openingHoursSpecification": {
"#type": "OpeningHoursSpecification",
"dayOfWeek": [
"Monday",
"Tuesday",
"Wednesday",
"Thursday",
"Friday"
],
"opens": "07:00",
"closes": "17:00"
},
The code that I would like to have there is something like this, but I can't validate it and I can't find any examples that show how it's done.
"openingHoursSpecification": {
"#type": "OpeningHoursSpecification",
"dayOfWeek": [
"Monday",
"Tuesday",
"Wednesday",
"Thursday",
"Friday"
],
"opens": "07:00",
"closes": "12:00",
"opens": "13:00",
"closes": "17:00"
},

Schema has the property specialOpeningHoursSpecification that:
The special opening hours of a certain place. Use this to explicitly
override general opening hours brought in scope by
openingHoursSpecification or openingHours.
My suggestion for markup for your lunch:
<script type="application/ld+json">
{
"#context":"https://schema.org",
"#type":"Restaurant",
"name":"GreatFood",
"openingHoursSpecification":{
"#type":"OpeningHoursSpecification",
"dayOfWeek":[
"Monday",
"Tuesday",
"Wednesday",
"Thursday",
"Friday"
],
"opens":"07:00",
"closes":"17:00"
},
"specialOpeningHoursSpecification":{
"#type":"OpeningHoursSpecification",
"dayOfWeek":[
"Monday",
"Tuesday",
"Wednesday",
"Thursday",
"Friday"
],
"closes": "12:00",
"opens": "13:00"
}
}
</script>
I have not been able to find official examples for this property. I am confused by the following saying in the documentation about type OpeningHoursSpecification:
If the value for the closes property is less than the value for the
opens property then the hour range is assumed to span over the next
day.
The documentation of Schema does not explicitly indicate how this is accounted for the property openingHoursSpecification. Therefore, I do not know how it will be understood by search engines. Perhaps the best solution is to create an experiment and analyze the result.

The solution using hoursAvailable in these older posts seems to be working. Tested with Google's testing tool:
Original Post: Including "siesta" in Schema.org OpeningHoursSpecification in JSON-LD
Code from the original post:
{
"#context": "http://schema.org",
"#type": "Service",
"url": "http://www.example.com/",
"hoursAvailable": [{
"#type": "OpeningHoursSpecification",
"opens": "08:00",
"closes": "13:00",
"dayOfWeek": [{
"#type": "DayOfWeek",
"#id": "http://schema.org/Monday",
"name": "Monday"
},
{
"#type": "DayOfWeek",
"#id": "http://schema.org/Tuesday",
"name": "Tuesday"
},
{
"#type": "DayOfWeek",
"#id": "http://schema.org/Wednesday",
"name": "Wednesday"
},
{
"#type": "DayOfWeek",
"#id": "http://schema.org/Thursday",
"name": "Thursday"
},
{
"#type": "DayOfWeek",
"#id": "http://schema.org/Friday",
"name": "Friday"
}]
},
{
"#type": "OpeningHoursSpecification",
"opens": "15:00",
"closes": "20:00",
"dayOfWeek": [{
"#type": "DayOfWeek",
"#id": "http://schema.org/Monday",
"name": "Monday"
},
{
"#type": "DayOfWeek",
"#id": "http://schema.org/Tuesday",
"name": "Tuesday"
},
{
"#type": "DayOfWeek",
"#id": "http://schema.org/Wednesday",
"name": "Wednesday"
},
{
"#type": "DayOfWeek",
"#id": "http://schema.org/Thursday",
"name": "Thursday"
},
{
"#type": "DayOfWeek",
"#id": "http://schema.org/Friday",
"name": "Friday"
}]
}]
}

Related

How do i add Likes Received to Structured Data in JSON-LD for Product Type

I've been trying to figure out a way to add how many likes were received to a product using structured data. Is what I have below correct? Or would the second example be more correct?
Is my usage of ["Product","InteractionCounter"] for the type correct in the first example?
I'm trying to have the google show a likes counter much like the aggregateRating property of Product.
I'm also not sure what the url in offers is supposed to point to or if it's necessary. Any ideas?
<script type="application/ld+json">
{
"#context": "https://schema.org",
"#type": ["Product","InteractionCounter"],
"name": "CC-1",
"description": "Wedding Cake",
"interactionType":{
"#type":"LikeAction",
"name": "Likes",
"description": "Likes Received"
},
"interactionService": {
"#type":"WebSite",
"url": "https://example.com/index.php?page=gallery"
},
"userInteractionCount": 55
}
</script>
OR
<script type="application/ld+json">
{
"#context": "https://schema.org",
"#type": "Product",
"name": "CC-1",
"description": "Wedding Cake",
"additionalProperty": {
"#type": "PropertyValue",
"name": "Likes",
"description": "Likes Received",
"value": 55
}
}
</script>
This is what I have right now:
<script type="application/ld+json">
{
"#context": "https://schema.org",
"#type": ["Product","InteractionCounter"],
"name": "CC-1",
"description": "Wedding Cake with bla bla bla",
"category": "Wedding Cakes",
"brand": {
"#type": "Brand",
"logo": "https://example.com/images/logo.png",
"slogan": "Cakes Are Nice"
},
"offers": {
"#type": "Offer",
"url": "https://example.com/anvil",
"priceCurrency": "CAD",
"price": "119.99"
},
"image": "https://example.com/collection/wedding_cakes/mid_def/CC-1",
"interactionType":{
"#type":"LikeAction",
"name": "Likes",
"description": "Likes Received"
},
"interactionService": {
"#type":"WebSite",
"url": "https://mimozas.com/index.php?page=gallery"
},
"userInteractionCount": "55 PLACEHOLDER"
}
If the product is the subject of content, then it makes sense to indicate likes as part of the type Product. My suggestion for you:
{"#context":"https://schema.org",
"#type":"Product",
"name":"CC-1",
"description":"Wedding Cake",
"subjectOf":{
"#type": "InteractionCounter",
"interactionType":{
"#type":"LikeAction",
"name":"Likes",
"description":"Likes Received"
},
"interactionService":{
"#type":"WebSite",
"url":"https://example.com/index.php?page=gallery"
},
"userInteractionCount":"55"
}
}
And be careful about inverted commas.
My addition after expanding the question.
I'm trying to have the google show a likes counter much like the
aggregateRating property of Product.
Google has no direct support for the type InteractionCounter - read more Explore the search gallery. However, in the rich test results of my suggestion, there are no errors or warning messages from Google:
Probably needs experimentation.

How to specify more than one areaServed (eg multiple municipalities) for a LocalBusiness?

A lot of businesses serve multiple municipalities.
How should this be expressed in https://schema.org/areaServed (JSON LD)?
Eg as per https://schema.org/Service:
<script type="application/ld+json">
{
"#context": "https://schema.org/",
"#type": "Service",
"serviceType": "Weekly home cleaning",
"provider": {
"#type": "LocalBusiness",
"name": "ACME Home Cleaning"
},
"areaServed": {
"#type": "City",
"name": "New York"
},
... ?
</script>
Should it be:
"areaServed": {
"#type": "City",
"name": "New York"
},
"areaServed": {
"#type": "City",
"name": "Buffalo"
},
"areaServed": {
"#type": "City",
"name": "Syracuse"
},
Or something like:
"areaServed": {
"#type": "City",
"name": "New York",
"name": "Buffalo",
"name": "Syracuse"
},
Or something else?
According to the Schema documentation, the property areaServed can have values expected to be one of these types:
AdministrativeArea
GeoShape
Place
Text
There is no type City here as you indicate in your example. So I used type Place for my suggestion for you (alternative is the type AdministrativeArea):
{
"#context": "https://schema.org/",
"#type": "Service",
"serviceType": "Weekly home cleaning",
"provider": {
"#type": "LocalBusiness",
"name": "ACME Home Cleaning"
},
"areaServed": {
"#type": "Place",
"name":[ "New York","Buffalo"]
}
}
To use an alternative just change the name to type.
City is a "More specific Type" of "AdministrativeArea" according to schema.org documentation, so nothing wrong with using that.
(unfortunately haven't got enough points to write this as a comment under nikant25s comment but thought it was important to mention)
I would write something like this:
"areaServed": [{
"#type": "City",
"name": “New York”,
"sameAs": "https://en.wikipedia.org/wiki/New_York_City"
},
{
"#type": "City",
"name": “Buffalo”,
"sameAs": (the Wiki-page for the right Buffalo)
}],
Since there are a lot of cities with the same name it’s probably good to use the sameAs property to specify which one you mean :)

Adding Schema.org 'Brand' in JSON-LD

I have been adding rich snippets to my ecommerce store, and for the most part I have had no problems. For some reason when I go to add in the "brand" that is recommeneded by Google and Google Merchant services I have problems.
I have added this under: http://schema.org/Offer. And by adding it in the script in my header also with no luck.
<script type="application/ld+json" data-resource-group="head_tag" data-resource-code="organization_schema">{
"#context": "http://schema.org",
"#type": "Organization",
"address": {
"#type": "PostalAddress",
"addressLocality": "",
"addressRegion": "",
"addressCountry": "",
"postalCode": "",
"streetAddress": ""
},
"email": "customerservice#domain.com",
"name": "Comany namee",
"telephone": "company number"
},
"brand":{
"#type":"Thing",
"name":"[manufacture_name]"
},
</script>
<meta itemprop="brand" content="[manufacturer_name]" />
"brand":{
"#type":"Thing",
"name":"[manufacture_name]"
},
The second one just simply isn't detected for some reason.
I have code similar to the meta tag throughout the documnet so I would prefer to keep with that format if possible.
Your JSON-LD has syntax errors:
The Organization is closed with },, but the brand property appears after it.
A closing } is missing.
There should be no , after the last }.
So it would be:
{
"#context": "http://schema.org",
"#type": "Organization",
"address": {
"#type": "PostalAddress"
},
"name": "company name",
"brand": {
"#type": "Brand",
"name": "manufacturer name"
}
}
(Note that I used Brand instead of Thing.)

How to define a ticket of ten in Schema.org "PriceSpecification"?

I try to get our pricing into the PriceSpecification scheme from Schema.org.
For our time based tickets this is pretty straight forward, like for our 3-month ticket:
"priceSpecification": {
"#type": "UnitPriceSpecification",
"priceCurrency": "USD",
"price": "10",
"referenceQuantity": {
"#type": "QuantitativeValue",
"value": "3",
"unitCode": "MON"
}
},
But we also have a "ticket of 10", which I try to describe, if possible with a unitCode and not a unitText.
Is there any UNECE/CEFACT code for this to describe or do I have to use unitText as fallback?

Errors in Google SDTT for Schema.org Product, Offer, and PriceSpecification

I'm new with Schema.org markup, so I've actually come up with the following codes for my real estate markup, and Google testing keep saying I shouldn't use offer for priceSpecification. I'm so lost now.
{
"#context": "http://schema.org/",
"#type": "Product",
"name": "Nodorus - Precinct 17",
"image": "http://www.setiaalam.com.my/images/products/p17/nodorus-c.jpg",
"description": "A distinct modern link residence set amidst award-winning green spans, wetland wonders and multiple amenities. Come home to articulately crafted spaces where architecture and nature's beauty infuse home with fresh chic. Rejoice in this cosy new addition to Setia Alam North.",
"additionalType": "Product",
"Offer": {
"#type": "PriceSpecification",
"priceCurrency": "RM",
"priceSpecification": {
"minPrice": "593000",
"maxPrice": "890000"
},
"availability": "http://schema.org/InStock",
"seller": {
"#type": "Organization",
"name": "S P Setia"
}
}
}
If you want to add an Offer for a Product, you have to use the offers property.
So instead of this (which doesn’t make sense, because Offer is not a property):
{
"#context": "http://schema.org/",
"#type": "Product",
"Offer": {}
}
You have to use this:
{
"#context": "http://schema.org/",
"#type": "Product",
"offers": {}
}
The type of the offers value should be Offer, not PriceSpecification.
The PriceSpecification can be added to the Offer via the priceSpecification property.
So the structure could look like:
{
"#context": "http://schema.org/",
"#type": "Product",
"offers": {
"#type": "Offer",
"priceSpecification": {
"#type": "PriceSpecification"
}
}
}