Search code examples
schema.orgjson-ldgoogle-rich-snippets

Confused about how @id in structured data works


Basically, I'm trying to add BlogPosting, TechArticle and WebPage structured data types to my posts, but I'm getting errors in Google's structured data testing tool. They seem to be centred around when I link back to an Organization structured data type I've defined on my homepage, to save me having to repeat the same code across multiple pages.

Here's the structured data testing tool instance. Can anybody explain how I can properly link to the Organization data type (which is sitting on my homepage) in the author, creator and publisher properties?

https://search.google.com/structured-data/testing-tool#url=https%3A%2F%2Fwww.lukeharrison.dev%2Farticles%2Fmike-brewer-motors-wins-best-online-experience-at-autotraders-2018-retailer-awards%2F

I feel as though it may be down to me not fully understanding the @id property, and how to properly can use it to link structured data together to reduce repetitive data.

Here's the code involved:

  • The BlogPosting
  • The linked Organisation
  • The errors I'm receiving

Example of BlogPosting

{
    "@context": "http://schema.org",
    "@type": "BlogPosting",
    "about": "Great news! Mike Brewer Motors - a project I've been heavily involved in over the past few years - has won the 'Best Online Experience' at the Autotrader 2018 Retailer Awards.",
    "articleSection": "Blog Posts",
    "author": {
        "id": "https://www.lukeharrison.dev#organization"
    },
    "copyrightHolder": {
        "id": "https://www.lukeharrison.dev#person"
    },
    "copyrightYear": "2019",
    "creator": {
        "id": "https://www.lukeharrison.dev#organization"
    },
    "dateCreated": "2018-07-20",
    "dateModified": "2018-07-20",
    "datePublished": "2018-07-20",
    "description": "Great news! Mike Brewer Motors - a project I've been heavily involved in over the past few years - has won the 'Best Online Experience' at the Autotrader 2018 Retailer Awards.",
    "genre": "Web Design & Front-End Development",
    "headline": "Mike Brewer Motors wins 'Best Online Experience' at Autotrader's 2018 Retailer Awards - Luke Harrison",
    "image": {
        "@type": "ImageObject",
        "height": 512,
        "url": "https://s.gravatar.com/avatar/c34b34964896ad0552a5b342ae08c1e2?s=512",
        "width": 512
    },
    "inLanguage": "en-GB",
    "isFamilyFriendly": "true",
    "keywords": [
        "news"
    ],
    "mainEntityOfPage": "https://www.lukeharrison.dev/articles/mike-brewer-motors-wins-best-online-experience-at-autotraders-2018-retailer-awards",
    "publisher": {
        "id": "https://www.lukeharrison.dev#organization"
    }
}

Example linked Organization, which sits on another page

{
    "@context": "http://schema.org",
    "@id": "https://www.lukeharrison.dev#organization",
    "@type": "Organization",
    "additionalType": [
        "http://www.productontology.org/id/Web_design",
        "http://www.productontology.org/doc/Search_engine_optimization",
        "http://www.productontology.org/doc/Web_development"
    ],
    "foundingDate": "2013",
    "legalName": "Luke Harrison - UX / Web Developer",
    "logo": "https://www.lukeharrison.dev/img/share-26bfb69f23.png",
    "name": "Luke Harrison - UX / Web Developer",
    "sameAs": [
        "https://twitter.com/webdevluke?lang=en-gb",
        "https://www.linkedin.com/in/lukedidit/",
        "https://github.com/WebDevLuke",
        "https://codepen.io/lukedidit/"
    ],
    "url": "https://www.lukeharrison.dev"
}

The errors I'm receiving in my BlogPosting structure

author, creator and publisher:

  • The attribute publisher.itemtype has an invalid value.

  • A value for the name field is required.


Solution

  • The errors are about Google’s Article rich result (if you don’t want to get this rich result, you can ignore these errors).

    For AMP pages, author and publisher are required properties. They require actual items as value, @id references are not supported. You can still provide the @id, but you need to specify the @type and the required properties in addition.