Skip to content

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

Closed

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: https://github.com/facebook/docusaurus/blob/6f9f8eeebd71fbe358bd80f2a2a32203948dab23/website/docs/seo.mdx#L36-L49

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.

Activity

  1. added
    feature
    status: needs triage
    on Sep 3, 2023
  2. Josh-Cena commented on Sep 3, 2023

    @Josh-Cena
    Collaborator

    It's "prefered" in the sense that it's less error-prone and easier to maintain—but if we don't need to maintain anything and there doesn't appear to be an error in the status quo, is there another good reason to migrate?

  3. johnnyreilly commented on Sep 3, 2023

    @johnnyreilly
    ContributorAuthor

    There's a number of good reasons to migrate:

    • it aligns with the approach favoured by the SEO industry and the main search engine Google
    • it aligns with other documentation on the Docusaurus website around using structured data

    More significantly than the above reasons, having JSON-LD structured data support with Docusaurus (assuming a similar implementation to previously) would mean a structured data component that is swizzle-able which gives users the ability to control their structured data directly, should they choose to want it to be slightly different to the specific contents of their blog.

    For instance, it would allow Docusaurus users to do more extensive knowledge graph support. JSON-LD is specifically designed for linked data, which means it's better suited for creating relationships between different pieces of data.

    This is just one example.

    And to be clear: I'm offering to do the work. I'm not proposing it with the expectation someone else would

  4. Josh-Cena commented on Sep 3, 2023

    @Josh-Cena
    Collaborator

    Swizzability does seem desirable. I also wonder if there are cases in the wild where people swizzle blog component and inadvertently broke microdata. This sounds reasonable to me.

  5. johnnyreilly commented on Sep 3, 2023

    @johnnyreilly
    ContributorAuthor

    I have really come to love swizzleability. And yes, I have decided that is a word!

  6. homotechsual commented on Sep 6, 2023

    @homotechsual
    Contributor

    I think this would be a solid change and the swizzlability alone makes it desirable.

  7. hrumhurum commented on Sep 30, 2023

    @hrumhurum
    Contributor

    A big benefit of JSON-LD when compared to microdata is that JSON-LD is easier to author, but more importantly, it's a stricter format designed for machine consumption and validation. Also, JSON-LD conveniently stays aside of content, meaning that it does not intermix with it, thus not producing a big mess like microdata tends to do.

    I used both formats in my practice. As the time went, Microdata turned out to be a royal pain, so I had to migrate to JSON-LD due to the aforementioned reasons. While microdata sounds like a neat idea, in practice JSON-LD is just better.

  8. johnnyreilly commented on Oct 1, 2023

    @johnnyreilly
    ContributorAuthor

    There seems to be general assent for this idea - I'm planning to do some work on it. Probably once I've migrated to Docusaurus v3

  9. johnnyreilly commented on Dec 24, 2023

    @johnnyreilly
    ContributorAuthor

    I'm starting to turn my attention to this now. All being well I'll see if I get a PR together over the holidays. Merry Christmas all! 🎄

  10. johnnyreilly commented on Jan 4, 2024

    @johnnyreilly
    ContributorAuthor

    I've now implemented this with #9669

  11. slorber commented on May 21, 2024

    @slorber
    Collaborator
  12. removed
    status: needs triage
    on May 21, 2024
  13. johnnyreilly commented on May 21, 2024

    @johnnyreilly
    ContributorAuthor

    Interesting!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions