There is any way to reuse data on json-ld? - json

There is some way to reuse data in json-ld?
I have a WebSite and an Organization schemas with name, url and social links on it, i'm trying to get a better Google SEO and maybe one Google Graph Card like this:
https://developers.google.com/search/docs/guides/enhance-site
My json-ld is something like this:
<script type="application/ld+json">
[
{
"#context": "http://schema.org",
"#type": "WebSite",
"name": "Name",
"url": "http://www.example.com"
},
{
"#context": "http://schema.org",
"#type": "Organization",
"name": "Name",
"url": "http://www.example.com",
"sameAs": [
"https://twitter.com/example"
]
}
]
</script>
There is some way to not repeat name and url in both schemas?
And am I doing right? i really need the Organization schema to get these social links on the google card? Or the "sameAs" key could be in the WebSite schema?
I am following this guides:
https://developers.google.com/search/docs/data-types/sitename
https://developers.google.com/search/docs/data-types/social-profile-links

Related

Duplicate JSON-LD scripts in head

I have to inject multiple script elements for JSON-LD data into the head of my application, all pertaining to the same #type. This is due to pulling in different fields from different data source.
Will this duplication cause any problems?
<script type="application/ld+json">
{
"#type": "Organisation",
"name": "John Smith"
}
</script>
<script type="application/ld+json">
{
"#type": "Organisation",
"city": "London"
}
</script>
I'm hoping this will be translated by Google as simply:
<script type="application/ld+json">
{
"#type": "Organisation",
"name": "John Smith",
"city": "London"
}
</script>
Is that right?
Consumers can’t/shouldn’t assume that these JSON objects describe the same thing. (Think of a web page with information about many different organizations: it would of course be wrong to assume that they are the same organization.)
JSON-LD allows you to specify that the things described in different objects are identical: give them the same #id value.
#id takes an IRI which acts as identifier (it’s useful to provide them for many reasons).
See Node Identifiers in the JSON-LD spec.
So it could look like this (using Schema.org instead of your custom vocabulary):
<script type="application/ld+json">
{
"#context": "http://schema.org",
"#type": "Organization",
"#id": "/organizations/42#this",
"name": "ACME"
}
</script>
<script type="application/ld+json">
{
"#context": "http://schema.org",
"#type": "Organization",
"#id": "/organizations/42#this",
"description": "…"
}
</script>
(The relative URL /organizations/42#this would represent the organization itself. It’s best practice then to provide this JSON-LD as well your information about the organization under /organizations/42.)

JSON-LD format for WebPage and BlogPosting

I have a medic weblog. My first page only has some data and top posts.
So I use this:
<script type="application/ld+json">
{
"#context": "http://schema.org",
"#type": "WebPage",
"name": "website name",
"description": "website description",
"publisher": {
"#type": "WebPageMedic",
"name": "my company name"
}
}
</script>
Now for another page, how can I write JSON-LD format?
I try this:
<script type="application/ld+json">
{
"#context": "http://schema.org",
"#type": "WebPage",
"name": "website name",
"description": "website description",
"publisher": {
"#type": "WebPageMedic",
"name": "my company name"
},
"mainEntity":{
"#type":"BlogPosting",
"headline":"BlogPosting",
"datePublished":"2015-03-09T13:08:00-07:00",
"articleBody": "articleBody"
}
}
</script>
I think I must write website information (WebPage) in all pages and then in mainEntity I can write BlogPosting and other things.
Am I right?
Yes, that is an appropriate structure if you want to have a WebPage item for every page (which is not necessary, but can be useful).
For a page that has multiple blog posts (in which case you might want to use CollectionPage), you could use a Blog item or an ItemList item as main entity. Another option is to use the hasPart property. See an example with mainEntity ItemList.
Notes about your example:
The properties of WebPage should be about the page, not about the site. You used "website name" and "website description". If you want to state something about your site, you can use the WebSite type.
There is no WebPageMedic type. You’ll probably want to use Organization or one of its sub-types, e.g., MedicalBusiness.

Schema.org - JSON-LD For External Sites?

I have some Schema.org JSON-LD like:
<script type='application/ld+json'>
{
"#context": "http://www.schema.org",
"#type": "WebSite",
"name": "Name",
"alternateName": "Alt Name",
"url": "http://Website.com"
}
</script>
And i have a website with pages where i list other peoples websites with a URL and a bit of info text.
Could i add the Schema.org JSON-LD data for all the external websites? like:
"name": "External Website 001",
Or does does it have to be used only once for my own website details on the main page etc?
If you want to say something about another website, it’s perfectly fine to use the WebSite type. Schema.org types are not required to be exclusively about your own things.
Let’s say you are reviewing the other website. Then you could use something like:
<script type="application/ld+json">
{
"#context": "http://schema.org",
"#type": "Review",
"url": "/reviews/acme-website",
"itemReviewed":
{
"#type": "WebSite",
"name": "ACME",
"url": "http://acme.example.com/"
}
}
</script>
If it’s not a review, but an article about the site, you could use Article (instead of Review) and its about property (instead of itemReviewed).

JSON-LD - Does using the `location` property the correct way to markup multiple business locations?

I am tasked to optimized our clients website using structured data (JSON-LD) to be search engine friendly. Our client's business has multiple locations and I am wondering if using the location property to structure the different business location is correct. Or should I just mark up each location separately?
Here is a sample code of what I did (although validating this using the Google structured data testing tool results in All good, I'm wondering if I am using the location property correctly)
Also, I remove some of the properties to make the code small and replace the values with generic values:
<script type="application/ld+json">
{
"#context": "http://schema.org",
"#type": "Attorney",
"name" : "Example Injury Lawyer",
"url": "http://example.com/",
"logo": "http://example.com/assets/images/logo.png",
"location": [{
"#type": "Attorney",
"#id": "http://example.com/offices/city-injury-lawyer",
"name": "Example Injury Lawyer",
"url": "http://example.com/offices/city-injury-lawyer",
"telephone": "+1-555-555-5555",
"address": {
"#type": "PostalAddress",
"streetAddress": "Street Address",
"addressLocality": "City",
"addressRegion": "Region",
"postalCode": "12345",
"addressCountry": "US"
}
}, {
"#type": "Attorney",
"#id": "http://example.com/offices/another-city-injury-lawyer",
"name": "Example Injury Lawyer",
"url": "http://example.com/offices/another-city-injury-lawyer",
"telephone": "+1-333-333-3333",
"address": {
"#type": "PostalAddress",
"streetAddress": "Street Address",
"addressLocality": "City",
"addressRegion": "Region",
"postalCode": "54321",
"addressCountry": "US"
}
}]
}
</script>
Google does not yet use location information to drive it's data.
The structured data it does use is here: https://developers.google.com/structured-data/
So if you are looking to add maps and the like to your search results then you need to submit directly to Google Maps and/or Google My Business. It wasn't until I did this that the maps for the website I worked in started showing up in SERPS and knowledge graph.
Saying all that, I'm firmly of the belief that the more data you can give Google the better and I'd imagine they will use it at some point (as you'd think a website would be able to definitely define its location better than Google Maps for example which anyone can contribute to ). Whether or how they will accept multiple businesses if/when they do that remains to be seen. So I'd leave your JSON-LD data as you have it and just check the structured data testing tool periodically and keep an eye on above link - both of which are good things to do anyway.

JSON-LD Create Single Review for Person

How would you go about creating a review for a person? For instance if a user, submitted a review that provided both a rating and an associated bit of information about a person's/service provider's quality of service... how should that be coded using JSON-LD? I think the code below is how you would correctly accomplish this but I'm not completely certain. If you have any suggestions, please include code with your input to provide maximum clarity.
Please keep in mind the code below is not for a page that lists all of the ratings but rather a single page that displays only this rating.
Person/Service Single Review:
<script type="application/ld+json">
{
"#context": "http://schema.org/",
"#type": "Review",
"itemReviewed": {
"#type": "Person",
"name": "John Smith", // Person being reviewd
},
"reviewRating": {
"#type": "Rating",
"bestRating": "5",
"ratingValue": "3",
"worstRating": "1"
}
"name": "Excellent Service!",
"author": {
"#type": "Person",
"name": "Bob Smith"
},
"reviewBody": "John provided excellent service!"
}
</script>
Ref: https://developers.google.com/structured-data/rich-snippets/reviews
Apart from the comment and two comma errors this is valid JSON-LD. I wouldn't expect this to show up as a rich snippet though. The page you referenced lists the entitz types for which reviews are supported: "We support reviews and ratings for a wide range of schema.org types, including businesses, products, and different creative works such as books or movies." If possible, I would thus associate the Review to a Service instead (the person can be made the provider of the service).
Here's the snippets with the two minor syntactic issues fixed:
<script type="application/ld+json">
{
"#context": "http://schema.org/",
"#type": "Review",
"itemReviewed": {
"#type": "Person",
"name": "John Smith"
},
"reviewRating": {
"#type": "Rating",
"bestRating": "5",
"ratingValue": "3",
"worstRating": "1"
},
"name": "Excellent Service!",
"author": {
"#type": "Person",
"name": "Bob Smith"
},
"reviewBody": "John provided excellent service!"
}
</script>