Search code examples
blogsschema.orgjson-ld

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?


Solution

  • 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.