hydrogen
hydrogen copied to clipboard
[SEO] Re-Support Canonical URLs with params
What is the location of your example repository?
https://github.com/Shopify/hydrogen/pull/1478
Which package or tool is having this issue?
Hydrogen
What version of that package or tool are you using?
v2023.10
What version of Remix are you using?
No response
Steps to Reproduce
In package < v2023.10 canonical URLs with params were supported. PR #1478 removed this support as "URL parameters shouldn't appear in canonical tag (in most cases)." but that PR negates any support for cases where they should appear. e.g. We have URLs like /ties?color=blue
that should be canonical (not /ties
)
Can that PR be reverted?
Expected Behavior
Return canonical as /ties?color=blue
Actual Behavior
Returns canonical as /ties
https://github.com/Shopify/hydrogen/pull/1478
WTF???
👋 Hi! Thanks for reporting this. We've been talking about this internally and we'll probably make some changes to the SEO component soon. cc @blittle
The main reason this change was made in the first place is often search parameters contain marketing identifiers that should never be a part of the canonical URL. We need to rethink how to do this. Potentially the SEO component could take an allow-list prop of search params that won't be stripped out. We are revisiting SEO more generally this quarter, and this should be addressed. In the mean time, if you require search params in your canonical URLs, I recommend not using the SEO component and instead just directly use export meta
from your remix routes.