Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: add blog microdata in markup instead of use JSON-LD #5355

Merged
merged 2 commits into from
Aug 17, 2021

Conversation

lex111
Copy link
Contributor

@lex111 lex111 commented Aug 13, 2021

Motivation

Instead of using JSON-LD, we can annotate current markup to support the BlogPosting schema.

Refs

Have you read the Contributing Guidelines on pull requests?

Yes

Test Plan

Try to test markup blog page on https://search.google.com/test/rich-results

The results below are relevant to first post on blog/2021/05/12/announcing-docusaurus-two-beta

Before After
image image

@lex111 lex111 added the pr: polish This PR adds a very minor behavior improvement that users will enjoy. label Aug 13, 2021
@lex111 lex111 requested a review from slorber as a code owner August 13, 2021 13:24
@facebook-github-bot facebook-github-bot added the CLA Signed Signed Facebook CLA label Aug 13, 2021
@netlify
Copy link

netlify bot commented Aug 13, 2021

✔️ [V2]

🔨 Explore the source changes: 347f6fe

🔍 Inspect the deploy log: https://app.netlify.com/sites/docusaurus-2/deploys/611672775b8a730007ea692f

😎 Browse the preview: https://deploy-preview-5355--docusaurus-2.netlify.app

@github-actions
Copy link

github-actions bot commented Aug 13, 2021

⚡️ Lighthouse report for the changes in this PR:

Category Score
🟠 Performance 89
🟢 Accessibility 98
🟢 Best practices 100
🟢 SEO 100
🟢 PWA 95

Lighthouse ran on https://deploy-preview-5355--docusaurus-2.netlify.app/

@github-actions
Copy link

github-actions bot commented Aug 13, 2021

Size Change: +1.17 kB (0%)

Total Size: 795 kB

Filename Size Change
website/build/blog/2017/12/14/introducing-docusaurus/index.html 64.1 kB -63 B (0%)
website/build/blog/index.html 34.3 kB +1.24 kB (+4%)
ℹ️ View Unchanged
Filename Size Change
website/.docusaurus/globalData.json 36.2 kB 0 B
website/build/assets/css/styles.********.css 93.1 kB 0 B
website/build/assets/js/main.********.js 404 kB 0 B
website/build/docs/index.html 41.9 kB -3 B (0%)
website/build/docs/installation/index.html 49.6 kB -3 B (0%)
website/build/index.html 28.7 kB 0 B
website/build/tests/docs/index.html 22.5 kB 0 B
website/build/tests/docs/standalone/index.html 20.5 kB 0 B

compressed-size-action

@netlify
Copy link

netlify bot commented Aug 13, 2021

✔️ [V2]

🔨 Explore the source changes: a6a9d53

🔍 Inspect the deploy log: https://app.netlify.com/sites/docusaurus-2/deploys/6116732589dbd4000732a021

😎 Browse the preview: https://deploy-preview-5355--docusaurus-2.netlify.app

@lex111 lex111 changed the title refactor: add blog microdata in markup intead of use JSON-LD refactor: add blog microdata in markup instead of use JSON-LD Aug 13, 2021
Copy link
Collaborator

@slorber slorber left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 looks nice!

Before merging, any thought @johnnyreilly ?

Note one diff is not the blog index has 3 article items. I don't feel like it should be a problem (and may be a good thing?) but it's worth double-checking how to handle a blog post paginated list?

@lex111
Copy link
Contributor Author

lex111 commented Aug 13, 2021

As I understand correctly, it's no big deal (try to check list page out in the checker). For example, Firebase blog in list of posts uses the same microdata as detail blog post.

@johnnyreilly
Copy link
Contributor

johnnyreilly commented Aug 15, 2021

Interesting! I didn't realise this was an option. I'll admit that I have an instinctive preference for JSON-LD as it's more obvious in terms of understanding what the data is. That said, this approach seems to work, as the screenshots attest.

I'm curious if there's any advantages to using microdata instead of JSON-LD? Or are they effectively interchangeable?

#5322

@lex111
Copy link
Contributor Author

lex111 commented Aug 15, 2021

I'm curious if there's any advantages to using microdata instead of JSON-LD? Or are they effectively interchangeable?

Well, I can not guarantee it, but according to the checker, final result on SEO should not change negatively.

@slorber
Copy link
Collaborator

slorber commented Aug 17, 2021

👍

@slorber
Copy link
Collaborator

slorber commented Aug 17, 2021

I'll admit that I have an instinctive preference for JSON-LD as it's more obvious in terms of understanding what the data is.

IMHO both have their pros and cons but 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

@slorber slorber merged commit ee68826 into master Aug 17, 2021
@slorber slorber deleted the lex111/use-html-microdata-blog branch August 17, 2021 10:21
@johnnyreilly
Copy link
Contributor

I was just reading around on structured data and found this post which (amongst other things) talks about microdata vs json-ld:

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

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

It comes down pretty much in favour of JSON-LD instead of microdata. I'm not too sure if it's significant - but I thought I'd mention it as at least interesting.

@lex111
Copy link
Contributor Author

lex111 commented Aug 24, 2021

Thanks for pointing this out, but just because JSON-LD is the preferred method, that doesn't make microdata less efficient, right? So let's leave the option with using microdata until we see confirmation that this format is worse.

@johnnyreilly
Copy link
Contributor

that doesn't make microdata less efficient, right?

I wouldn't claim expertise in this area. But they do come down firmly in favour of JSON-LD and against microdata:

The classic way of writing structured data for inclusion on your pages involves directly embedding it into your HTML. This made a really inefficient and error-prone process and is much of the reason why the uptake of Schema.org hasn’t been particularly fast. Writing and maintaining it via RFDa or Microdata is a pain. Believe us, try to do as much as you can in JSON-LD.

Happy to leave as is for now. But we should probably keep this under review if the industry is moving in the direction of JSON-LD

@slorber
Copy link
Collaborator

slorber commented Aug 24, 2021

I'd rather keep microdata for now, as I find it more convenient for composition. We'll see if any limit is encountered and eventually migrate to json-ld

@johnnyreilly
Copy link
Contributor

johnnyreilly commented Aug 24, 2021

Cool - I found this article from 2019: 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...

... Google’s stated preference is for JSON-LD. It may be in your best interest to consider switching over to JSON-LD structured data if you currently use microdata. But at this time it’s not actually necessary because Google can still read it and interpret it. But sometimes, it’s best to future proof content. It’s up to you at this time because Google isn’t actually requiring one format over another.

Assuming what it says still stands, JSON-LD is preferred by Google, but not required which is good. And their tools seem to confirm that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed Signed Facebook CLA pr: polish This PR adds a very minor behavior improvement that users will enjoy.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants