Hopefully this is the right place for this question - I've got a setup where only 1 product exists.
Because the product exists at the product URL without any issues, I don't really want the collections/all page to be indexed.
Is there a way to edit the canonical tag for the collections/all page (https://www.site.com/collections/all) so that it isn't self-referencing but instead points to my Product URL?
The collections page is indexed in Google / showing for some queries and I'd rather avoid this if I can.
Thanks for any help!
The best option would be a URL redirect. Unfortunately, those only work for pages that would otherwise return a 404.
The approach I would recommend for you is to update your theme's header. There will be a section that emits the link rel=canonical tag. You can add a little bit of liquid logic to check the global canonical_url object to see if it is equal to /collections/all. If it is, emit the appropriate canonical URL for your product.
You may also want to emit the http-equiv=refresh meta tag, to hint to browsers to automatically redirect to the product page.
Hope that helps! Let me know if you have follow up questions.
Thanks very much for this, Code402!
This seems a bit of a strange setup - to only be able to add a redirect if the page serves a 404. Do you know if my situation described is common - and whether it's worth making that change to the theme header?
From my reports I can see the collections page I refer to is indexed in Google, and does get a small amount of search traffic - so from an SEO perspective it seems like the canonical edit is needed (with the redirect being impossible to add).
Unfortunately, the limits of control over URL structure is a pretty popular complaint if you search for Shopify SEO stories. 😞
Hopefully you'll find that it's worth it - the rest of the Shopify platform is pretty powerful.
We've been able to adjust the canonical tags for our clients to point to product pages by using the following solution: https://community.shopify.com/c/Shopify-Discussion/Duplicate-Content-Same-Page-with-different-url/td...
Hopefully this works for your situation! If not, you might also be able to inject a canonical using Google Tag Manager!
Connect your PayPal account to allow your customers to checkout using the PayPal gateway a...By Ollie Jul 28, 2022