hydrogen icon indicating copy to clipboard operation
hydrogen copied to clipboard

[SEO] Re-Support Canonical URLs with params

Open rickydazla opened this issue 6 months ago • 3 comments

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

rickydazla avatar Jan 30 '24 17:01 rickydazla

https://github.com/Shopify/hydrogen/pull/1478

WTF???

jayvin avatar Jan 31 '24 04:01 jayvin

👋 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

frandiox avatar Jan 31 '24 05:01 frandiox

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.

blittle avatar Jan 31 '24 14:01 blittle