How to remove URL parameters from canonical URLs in Shopify

To drop URL parameters for all the pages:

<link rel="canonical" href="{{ canonical_url | split: "?" | first }}">

Based on the https://shopify.github.io/liquid/filters/first/

and https://shopify.github.io/liquid/filters/first/

Because there are too many errors with the “Alternate Page with Proper Canonical Tag”, but also “Crawled Not Indexed”.

Leave a comment