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.
Related
We have successfully implemented Gmail Annotations for our emails. However, with Black Friday around the corner, we wanted to utilize multiple images with Catalog Cards. I found the reference guide that calls out the Item Properties and such, but I have no idea how to code this into JSON-LD. I use 250ok/Validity's script as a base, which is below. Can someone help me code or provide sample code for the Catalog Card annotation?
<script type="application/ld+json">
[{
"#context": "http://schema.org/",
"#type": "Organization",
"logo": "http://250ok.com/img/favicon-black.png"
},{
"#context": "http://schema.org/",
"#type": "EmailMessage",
"subjectLine": "Time to renew your 250ok Account"
},{
"#context": "http://schema.org/",
"#type": "DiscountOffer",
"description": "10% off",
"discountCode": "RENEW2019",
"availabilityStarts": "2020-11-06T08:00:00-07:00",
"availabilityEnds": "2020-11-25T08:00:00-07:00"
},{
"#context": "http://schema.org/",
"#type": "PromotionCard",
"image": "https://s3.amazonaws.com/250ok-wordpress/wp-content/uploads/2018/12/03212604/promo_sample.png"
}]
</script>
Example Image of the Catalog Card Carousel
I have seen the catalog cards working in the latest version of Gmail on Android when using a Gmail account that ends in promotabtesting#gmail.com. I have not seen this work on an iOS device yet nor on non-testing Gmail accounts (https://developers.google.com/gmail/promotab/best-practices#testing)
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.)
Adding additional entries when a business has more than one phone number or emails, etc., how do you do this in a json-ld file?
It works fine in html, but when I add a second item in json and run it through the validator it return the last one entry, i.e., if I list three phone numbers it return last number.
You have to define for example "Telephone" in this way :
{
"#context": "http://schema.org",
"#type": "Example",
"email": "mailto:example#example.com",
"telephone": [
"+123456789",
"+987654321"
]
}
You check your Schema with Google tool checker
It's note a valid code, you forget to add "," to the last line for phone tags :
{
"#context": "http://schema.org",
"#type": "Example",
"email": "mailto:example#example.com",
"telephone": [
"+123456789",
"+987654321"
],
}
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).
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