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 robots configuration to SEO meta tags #572
Conversation
}, | ||
]), | ||
); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it worth adding a test for a page-level robots overwriting global robots?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We'd need to add a lot of utilities for more e2e style testing like this... And wouldn't be a test for this abstraction, but actually the part that touches Remix/React (aka the <Seo />
component).
You are right we should have these, but its a bigger deal and doesn't make sense in this PR.
// TODO: Refactor this into more reusible validators | ||
// or use a library like zod to do this if we decide | ||
// to use it in other places. @cartogram | ||
// TODO: Refactor this into more reusible validators or use a library like zod to do this if we decide to use it in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should create an issue or a discussion about zod
to get it going.
I think there's enough use cases for it (analytics, seo, cart) etc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree its worth experimenting with as it is big part of astro, and even other framework's use it for this exact purpose (like Nuxt's Head abstraction).
@frehner and I talked very briefly about it. In a previous iteration of this generate-seo-tags
I used it (but it was still very rushed and did more harm than good at the time).
@juanpprieto do you want to start that discussion?
maxSnippet && `max-snippet:${maxSnippet}`, | ||
maxVideoPreview && `max-video-preview:${maxVideoPreview}`, | ||
unavailableAfter && `unavailable_after:${unavailableAfter}`, | ||
]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could do [].filter(Boolean)
to get rid of undefined
values
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great @cartogram 🥇
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good ✅
@pshapiro would love your 👀 on this one to determine if this is the right amount of flexibility for merchants. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The implementation looks good to me!
Hi all, I was looking into this merged PR, because I'm having trouble getting my twitter cards to display on our webshop. I believe the issue is that there is no |
@svrnhdl Please follow this guide https://shopify.dev/docs/custom-storefronts/hydrogen/seo/manage-seo#step-3-override-seo-values-on-the-product-details-page and open a new discussion or issue if you have problems. Thanks! |
WHY are these changes introduced?
This PR allows developers to set values in the SEO config to generate a robots meta tag in the Head of the document.
WHAT is this pull request doing?
This PR adds a
robots
option that allows users granular control over the robots meta tag. Like all SEO config values, this can be set on both a global and per-page basis using thehandle.seo
property.HOW to test your changes?
Run the demo store and look for the
robots
meta tag. You can try different values and check the various results.Post-merge steps
Checklist