Generating a Json schema with Google Shopping custom label - schema.org

I am trying to add a custom label 0 shopping attribute to my Json schema but I don't get the this new attribute on my products.
I tried:
<script type="application/ld+json">
{
"#context": "https://schema.org/",
"#type": "Product",
"name": "Auvers - Van Gogh",
"sku":"artworkid[2316]-product[canvas]",
"mpn":"artworkid[2316]-product[canvas]",
"tags": [{
"custom_label_0": "Fine Art"
}
],
And also:
<script type="application/ld+json">
{
"#context": "https://schema.org/",
"#type": "Product",
"name": "Auvers - Van Gogh",
"sku":"artworkid[2316]-product[canvas]",
"mpn":"artworkid[2316]-product[canvas]",
"customLabel0": "Fine Art",
How to set this attribute with the structured data?
I didn't find any infos from the custom label support from Google:
https://support.google.com/merchants/answer/6324473?hl=en#zippy=%2Cexample-values

Related

Is it possible to reference by #id without Schema.org inlining the object?

I am trying to set up Schema.org on a website, but I have trouble understanding how to use the #id attribute.
I want to specify a Corporation and a WebSite. Here is the code without a reference between the two objects:
<script type="application/ld+json">
[{
"#context": "https://schema.org",
"#id": "https://www.example.com/#corporation",
"#type": "Corporation",
"name": "Company Name",
"legalName": "Company Name",
"description": "Company Description",
"url": "https://www.example.com",
"logo": "https://www.example.com/logo"
},
{
"#context": "https://schema.org",
"#type": "WebSite",
"name": "Example",
"url": "https://www.example.com"
}]]
</script>
The Schema.org validator finds both the Corporation and the WebSite. Google's Rich result test tool finds the logotype, as expected. Now, I want to add a reference to the Corporation as the publisher of the WebSite.
<script type="application/ld+json">
[{
"#context": "https://schema.org",
"#id": "https://www.example.com/#corporation",
"#type": "Corporation",
"name": "Company Name",
"legalName": "Company Name",
"description": "Company Description",
"url": "https://www.example.com",
"logo": "https://www.example.com/logo"
},
{
"#context": "https://schema.org",
"#type": "WebSite",
"name": "Example",
"url": "https://www.example.com",
"publisher": {
"#id": "https://www.example.com/#corporation"
}
}]]
</script>
The Schema.org validator now only shows the WebSite and has inlined the Corporation as publisher. The Google tool does not find any objects, but I was expecting it to still find the logotype.
I have spent quite some time with the Schema.org docs and searched the internet but I can't find an explanation to this behavior.
Am I doing it the wrong way? Thanks in advance.
At the moment logo is only shown in reports if it is in a top-level Organization entity. It is still recognised internally.
Google's logic sometimes ignores embedded entities.
I found a reference from Google on this. Point 2:

Can I use #id to join multiple JSON-LD scripts to a valid object?

Is this valid? I need an opportunity to join diffrent script blocks on one page to a valid object.
<script type="application/ld+json">
{
"#context": "http://schema.org",
"#type": "Product",
"#id": "#111",
"description": "Test description",
"name": "My Product"
}
</script>
<script type="application/ld+json">
{
"#context": "http://schema.org",
"#type": "Product",
"#id": "#111",
"aggregateRating": {
"#type": "AggregateRating",
"ratingValue": "3.5",
"reviewCount": "11"
}
}
</script>
why should these scripts be joined? They describe the same product and are partly redundant.
But if you are looking for possibility to join scripts by id - yes, it exists. I.e. you have two scripts: first - product and its rating, second - organization offering this product. In this case the joining would look like:
<script type="application/ld+json">
{
"#context": "http://schema.org",
"#type": "Organization",
"makesOffer": {
"#type": "Offer",
"itemOffered": {
"#type": "Product",
"#id": "https://www.example.com#111"
}
}
}
</script>
<script type="application/ld+json">
{
"#context": "http://schema.org",
"#type": "Product",
"id": "https://www.example.com#111",
"aggregateRating": {
"#type": "AggregateRating",
"ratingValue": "3.5",
"reviewCount": "11"
}
}
</script>
I often do that when the review system adds its own markup separately to the product markup. It works fine.
You can test it in the Structured Data Testing Tool. It should merge the two into one.

Multiple #types together or in separate script tags?

I'm trying to wrap my head around this and I've read through several tutorials including schema.org documentation and Googles structured data guides and I can't find a clear answer on this. It's intuitive how to do this with microdata but not so much using JSON-LD. Let's say I have a website that is a local business and I offer products for sale. How would I combine both the LocalBusiness and Products into the same JSON-LD block of code? They are separate objects as far as my understanding.
Would the code look more like this...
<script type="application/ld+json">
{
"#context": "http://schema.org",
"#type": "LocalBusiness",
"name": "My Business"
}
{
"#context": "http://schema.org",
"#type": "Product",
"name": "My Proudct"
}
</script>
or in separate script tags like this...
<script type="application/ld+json">
{
"#context": "http://schema.org",
"#type": "LocalBusiness",
"name": "My Business"
}
</script>
<script type="application/ld+json">
{
"#context": "http://schema.org",
"#type": "Product",
"name": "My Proudct"
}
</script>
or something else altogether?

How do I reference another item on the same page using schema.org? [duplicate]

I have a question about referencing a JSON-LD schema.org markup in another JSON-LD schema.org markup. I have a page with a main event which is located at http://event.com/ and here's the JSON-LD markup for it.
<script type="application/ld+json">
{
"#context": "http://schema.org",
"#type": "Event",
"name": "MainEvent",
"startDate": "2016-04-21T12:00",
"location": {
...
}
}
</script>
Main event has multiple sub events located at for example http://event.com/sub-event-1/ and here's the JSON-LD markup for that:
<script type="application/ld+json">
{
"#context": "http://schema.org",
"#type": "Event",
"name": "SubEvent",
"startDate": "2016-04-21T12:00",
"location": {
...
}
}
</script>
What I'm trying to do is mark up the subevent as part of the main event. Is it possible to create a reference from the main event to sub event? Something like this:
<script type="application/ld+json">
{
"#context": "http://schema.org",
"#type": "Event",
"name": "SubEvent",
"startDate": "2016-04-21T12:00",
"location": {
...
}
superEvent {
"url": "http://event.com/"
}
}
</script>
If it's possible, what's the correct markup for reference. I can't find any information about it.
Or is it required to embed the MainEvent in every single SubEvent like this:
<script type="application/ld+json">
{
"#context": "http://schema.org",
"#type": "Event",
"name": "SubEvent",
"startDate": "2016-04-21T12:00",
"location": {
...
},
"superEvent": {
"#type": "Event",
"name": "MainEvent",
"startDate": "2016-04-21T12:00",
"location": {
...
}
}
}
</script>
You can identify a node by giving it a URI, specified in the #id keyword. This URI can be used to reference that node.
See the section "Node Identifiers" in the JSON-LD spec.
So your main event could get the URI http://example.com/2016-04-21#main-event:
<script type="application/ld+json">
{
"#id": "http://example.com/2016-04-21#main-event",
"#context": "http://schema.org",
"#type": "Event",
"name": "MainEvent",
"startDate": "2016-04-21T12:00"
}
</script>
and you could give this URI as the value for the sub event’s superEvent property:
<script type="application/ld+json">
{
"#context": "http://schema.org",
"#type": "Event",
"name": "SubEvent",
"startDate": "2016-04-21T12:00",
"superEvent": { "#id": "http://example.com/2016-04-21#main-event" }
}
</script>
(You could of course give your sub event an #id, too. This would allow you and others to identify/reference this sub event.)
What you are looking for a node identifiers (see http://www.w3.org/TR/json-ld/#node-identifiers). You assign each entity a unique identifier in the form of a URL and use it in references:
<script type="application/ld+json">
{
"#context": "http://schema.org",
"#id": "http://event.com/#mainEvent",
"#type": "Event",
"name": "MainEvent",
"startDate": "2016-04-21T12:00",
"location": {
...
}
}
</script>
Above you see I gave the event an #id. I appended a fragment (#mainEvent) because http://event.com/ would typically identify the page itself. You can then reference the event as follows:
<script type="application/ld+json">
{
"#context": "http://schema.org",
"#type": "Event",
"name": "SubEvent",
"startDate": "2016-04-21T12:00",
"location": {
...
}
superEvent {
"#id": "http://event.com/#mainEvent"
}
}
</script>
Embedding as shown in your example works as well. In that case, you won't need the identifiers as it is clear what references what.

Schema.org JSON-LD reference

I have a question about referencing a JSON-LD schema.org markup in another JSON-LD schema.org markup. I have a page with a main event which is located at http://event.com/ and here's the JSON-LD markup for it.
<script type="application/ld+json">
{
"#context": "http://schema.org",
"#type": "Event",
"name": "MainEvent",
"startDate": "2016-04-21T12:00",
"location": {
...
}
}
</script>
Main event has multiple sub events located at for example http://event.com/sub-event-1/ and here's the JSON-LD markup for that:
<script type="application/ld+json">
{
"#context": "http://schema.org",
"#type": "Event",
"name": "SubEvent",
"startDate": "2016-04-21T12:00",
"location": {
...
}
}
</script>
What I'm trying to do is mark up the subevent as part of the main event. Is it possible to create a reference from the main event to sub event? Something like this:
<script type="application/ld+json">
{
"#context": "http://schema.org",
"#type": "Event",
"name": "SubEvent",
"startDate": "2016-04-21T12:00",
"location": {
...
}
superEvent {
"url": "http://event.com/"
}
}
</script>
If it's possible, what's the correct markup for reference. I can't find any information about it.
Or is it required to embed the MainEvent in every single SubEvent like this:
<script type="application/ld+json">
{
"#context": "http://schema.org",
"#type": "Event",
"name": "SubEvent",
"startDate": "2016-04-21T12:00",
"location": {
...
},
"superEvent": {
"#type": "Event",
"name": "MainEvent",
"startDate": "2016-04-21T12:00",
"location": {
...
}
}
}
</script>
You can identify a node by giving it a URI, specified in the #id keyword. This URI can be used to reference that node.
See the section "Node Identifiers" in the JSON-LD spec.
So your main event could get the URI http://example.com/2016-04-21#main-event:
<script type="application/ld+json">
{
"#id": "http://example.com/2016-04-21#main-event",
"#context": "http://schema.org",
"#type": "Event",
"name": "MainEvent",
"startDate": "2016-04-21T12:00"
}
</script>
and you could give this URI as the value for the sub event’s superEvent property:
<script type="application/ld+json">
{
"#context": "http://schema.org",
"#type": "Event",
"name": "SubEvent",
"startDate": "2016-04-21T12:00",
"superEvent": { "#id": "http://example.com/2016-04-21#main-event" }
}
</script>
(You could of course give your sub event an #id, too. This would allow you and others to identify/reference this sub event.)
What you are looking for a node identifiers (see http://www.w3.org/TR/json-ld/#node-identifiers). You assign each entity a unique identifier in the form of a URL and use it in references:
<script type="application/ld+json">
{
"#context": "http://schema.org",
"#id": "http://event.com/#mainEvent",
"#type": "Event",
"name": "MainEvent",
"startDate": "2016-04-21T12:00",
"location": {
...
}
}
</script>
Above you see I gave the event an #id. I appended a fragment (#mainEvent) because http://event.com/ would typically identify the page itself. You can then reference the event as follows:
<script type="application/ld+json">
{
"#context": "http://schema.org",
"#type": "Event",
"name": "SubEvent",
"startDate": "2016-04-21T12:00",
"location": {
...
}
superEvent {
"#id": "http://event.com/#mainEvent"
}
}
</script>
Embedding as shown in your example works as well. In that case, you won't need the identifiers as it is clear what references what.