JSON-LD, enrich search engine results

How to display rich snippets on Google, Bing, Yandex, Yahoo? Make search engines understand the content of a web page.

Find more tutorials explaining the basics of a subject in ten minutes with the tag what is it.

In the previous tutorial Microdata, enrich search engine results we learned that microdata are HTML attributes used to make search engines understand a web page.

JSON-LD, LD standing for "linked data", is the way recommended by Google in order to describe the content of a web page. You can use JSON-LD as an alternative to microdata.

JSON-LD is not just an SEO tool, it's a widely used format, supported by the W3C, designed to add context to all kinds of web resources. Search engines use this format for building their knowledge graph. By putting a JSON-LD schema in the header of your page, you make it understandable by Google and its friends.

As suggested by its name, JSON-LD is based on JSON. It adds a syntax to some special attributes used to describe the fetched web resource: its type, its ID and so on...

Following the example previously seen with the microdata:

TechArticle described with JSON-LD

<script type="application/ld+json"> { "@context": "https://schema.org", "@type": "TechArticle", "headline": "Microdata, enrich search engine results", "description": "How to customize the way a result is displayed by Google, Bing and their friends? Make search engines understand the content of a web page.", "datePublished": "2020-11-08", "dateModified": "2020-11-08", "author": { "@type": "Person", "name": "Nicolas Gautron", "image": { "@type": "ImageObject", "url": "https://tuto4.dev/authors/NicolasGautron.jpeg" } } } </script>

All the types and properties are available in the JSON-LD documentation, it's actually the same documentation used for the microdata.

Before reading the entire documentation, go read Google's recommendations on structured data.

Like for microdata, don't forget to test your page with a tool like Google's structured data tester.

Have a nice day :)