Skip to content

Proposal: migrate blog structured data back to JSON-LD #9274

@johnnyreilly

Description

@johnnyreilly

Have you read the Contributing Guidelines on issues?

Description

I originally contributed Structured Data support for blog posts back in 2021: #5322

@lex111 subsequently submitted a PR to migrate the approach to use microdata instead: #5355

I had reservations which I voiced at the time, but left it at that. Since then time I've had something of a baptism of fire around the world of SEO. And consequently I've been working with some excellent folk in the SEO industry to improve my own ranking.

A thing that comes up repeatedly is a suggestion to use JSON-LD instead of microdata as that is what Google prefers, and it affords more possibilities for implementing a knowledge graph in your site.

I'd like to investigate moving Docusaurus back to using JSON-LD for blog Structured Data, but with some slight differences in approach to my original approach. I've raised this issue to discuss it.

Relevant links on JSON-LD

Google recommend JSON-LD as a format:

https://developers.google.com/search/docs/appearance/structured-data/intro-structured-data#supported-formats

In general, Google recommends using JSON-LD for structured data if your site's setup allows it, as it's the easiest solution for website owners to implement and maintain at scale (in other words, less prone to user errors).

https://www.searchenginejournal.com/google-structured-data-preference/297479/

In a Webmaster Hangout, Google’s John Mueller was asked what kind of structured date Google prefers. John Mueller answered that Google prefers JSON-LD structured data.

https://yoast.com/structured-data-schema-ultimate-guide/#son

JSON-LD is the preferred method of adding structured data to your site

What I'd implement differently this time

@slorber said

I tend to prefer co-locating things, it improves composability and make sure all pages using a cmp with structured data will be well-understood by crawlers without additional work

I agree with this sentiment. In my original implementation I was rendering the JSON-LD to head tags which it turns out is completely unnecessary (and unhelpful for the reasons documented by @slorber). Consider the about page of my site:

https://johnnyreilly.com/about

This has Person Structured Data implemented in the body of the page, the structured data validator validates this

image

What do people think?

I'm happy to do this work, but I don't want to devote time to it if there's no hope of it landing. So I wanted to solicit thoughts here first.

Finally, it's worth noting that we advocate using JSON-LD in the SEO docs of Docusaurus:

// Declare some json-ld structured data
{
tagName: 'script',
attributes: {
type: 'application/ld+json',
},
innerHTML: JSON.stringify({
'@context': 'https://schema.org/',
'@type': 'Organization',
name: 'Meta Open Source',
url: 'https://opensource.fb.com/',
logo: 'https://opensource.fb.com/img/logos/Meta-Open-Source.svg',
}),
},

Feels like it would be good to use one format of Structured Data rather than a variety; principle of least surprise etc.

Has this been requested on Canny?

No

Motivation

See description

API design

LIkely the same as the original implementation but not rendering to the Head

Have you tried building it?

Yes

Self-service

  • I'd be willing to contribute this feature to Docusaurus myself.

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureThis is not a bug or issue with Docusausus, per se. It is a feature request for the future.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions