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

Add JSON-LD support for all pages #93

Merged
merged 1 commit into from
Nov 15, 2020

Conversation

GuilleAngulo
Copy link
Collaborator

@GuilleAngulo GuilleAngulo commented Nov 8, 2020

Description

It creates JSON-LD support by adding the json-ld script to the React Helmet. There are 4 main structures:

1.- ArticleJsonLd - For blog posts
2.- WebsiteJsonLd - For index (with integrated searchbox)
3.- AuthorJsonLd - For authors page
4.- WebpageJsonLd - This is the most generic one. Is used in all the rest of pages.

I've checked results with different values at https://search.google.com/structured-data/testing-tool, and I believe is working fine.

For Article the image appears to be a recommended/important field and not every time a post has a featuredImage, so when #13 is solved would be great to include it as the default image for the post in case there is no featureImage.

Fixes #92

src/lib/json-ld.js Outdated Show resolved Hide resolved
src/lib/json-ld.js Outdated Show resolved Hide resolved
src/lib/json-ld.js Outdated Show resolved Hide resolved
@colbyfayock
Copy link
Owner

this is looking good @GuilleAngulo - a few comments there

its interesting, google's updated rich testing tool (https://search.google.com/test/rich-results) doesnt show anything for categories like https://deploy-preview-93--next-wordpress-starter.netlify.app/categories/lorem/ but it clearly works when testing on the old tool at https://search.google.com/structured-data/testing-tool

i wonder if it specifically only tests and shows rich actions, not general structured data

anyways lookin good

@GuilleAngulo
Copy link
Collaborator Author

I was checking this last issue you are mentioning, and I think I figured out why: So aparently Google indicates at their guide which structures/features they will considerate in order to show rich results. From the 4 structures, only Article (blog post) and Sitelinks Search box (index) qualify for this. Author and WebPage will have structured data but will be ignore by Google rich results...

Also checking this one I found that logo could qualify as rich result. Shall I include a logo structure at index page? Would be an interesting default feature?

src/lib/json-ld.js Outdated Show resolved Hide resolved
@colbyfayock
Copy link
Owner

ah thats interesting

maybe the logo can be an opt-in feature? 🤔 only thinking is right now there's no logo on the site, but maybe i can come up with a simple logo later just for the purposes of having a placeholder image for people to swap in their own, then we can include it in this

@GuilleAngulo
Copy link
Collaborator Author

Yeah, I will leave the structure of LogoJsonLd() prepared inside the file. So you can use whenever is ready 👍

Just another note: Now the logo is taken like this:
const { homepage = '', faviconPath = '/favicon.ico' } = config;
Because I was not sure where should the logo path come from. So by default is taking 'favicon.ico' or faviconPath property if exists at package.json... Any thoughts?

@colbyfayock
Copy link
Owner

i think that works for now until we get it set up. thanks @GuilleAngulo

@colbyfayock colbyfayock merged commit 1f56809 into colbyfayock:master Nov 15, 2020
@GuilleAngulo
Copy link
Collaborator Author

I sent the dates wrong again ... I think I had a mental block with that part 😅. Thanks for fixing!

@GuilleAngulo GuilleAngulo deleted the jsonld branch November 16, 2020 14:21
@colbyfayock
Copy link
Owner

haha np, didn't wanna bug ya again for the quick tweak

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

JSON-LD Structured data
2 participants