SEO, AdWords, affiliates, advertising, and promotions
Hello,
I have a few duplicate product pages because I wanted to show some variants as separate products on collection pages without messing up the pagination.
To avoid having them flagged as duplicate content, I want to group these products using automatic collections (set to manual sorting and inventory >1). All these products will have a metafield with the collection handle they are related to. Now in my theme, I want to add an if statement that checks if a product has this metafield and if it does, set the canonical_url to the first product's canonical_url instead.
This way if a product is deleted from the collection, all other products that use that canonical_url will be updated to a new URL instead.
Any thoughts on this?
Overall goal is workable.
How are you mapping dupes to the canonicals? How does logic know /products/blue-shirt should be products/shirts
(set to manual sorting and inventory >1)
Don't do that that just adds all products to a collection that track inventory.
Either manually add the products or use tags or some other condition that wont create false positives in now or in future.
This part reads nonsensically:
if a product is deleted from the collection, all other products that use that canonical_url will be updated to a new URL instead
Products have no concept of other products there's no built in automation to update other products when a product is deleted.
If a standalone-variant-product-duplicate(SVPD) is deleted that's it no need to point to the canonical product there's nothing to check because nothing exists anyway to do the pointing.
Meanwhile if a canonical-product is deleted then any SVPD that are hardwired to point to the canonical-product now point to a 404.
Psuedo
if product.metafields.seo.SVPD _duplicate
canonical_product = canonical product finding convention and logic
OR canonical_product = savp.metafields.seo.canonical_product
canonical_url = canonical_product.url | filters for formatting URIs
<link rel="canonical" href="{{ canonical_url }}">
Save time & money ,Ask Questions The Smart Way
Confused? Busy? Get the solution you need paull.newton+shopifyforum@gmail.com
Problem Solved? ✔Accept and Like solutions to help future merchants
Answers powered by coffee Buy Paul a ☕ Coffee for more answers or donate to eff.org
Overall goal is workable.
How are you mapping dupes to the canonicals? How does logic know /products/blue-shirt should be products/shirts
(set to manual sorting and inventory >1)
Don't do that that just adds all products to a collection that track inventory.
Either manually add the products or use tags or some other condition that wont create false positives in now or in future.
My mistake, there will be different collections for example shirt-blue, shirt-red, shirt-green are all in one collection called shirt while hat-blue, hat-red, hat-green are on a collection called hat. The reason for inventory > 0* (not 1) is so if a product is out of stock, the traffic go to the next available product. Essentially, the new canonical_url for other products is automatically updated when the main product changes.
So it will look like this:
Collection name Shirt: Products:
| Collection name Hat: Products:
|
If Shirt Blue is discontinued for example then the collection will contain only two shirts which then automatically pick a different URL as the main product (I don't have to manually change all of them).
So there is no reason for products to get updated when another product gets deleted, rather the theme.liquid has an if statement that chooses the URL; so no 404 error. (The only catch is that search engines need time to crawl).
User | RANK |
---|---|
9 | |
7 | |
5 | |
5 | |
4 |
Make the shift from discounts to donations, and witness your business not only thrive fina...
By Holly Dec 4, 2023On our Shopify Expert Marketplace, you can find many trusted third party developers and fr...
By Arno Nov 27, 2023You've downloaded the Search & Discovery app from the Shopify App store, and as you're ...
By Skye Nov 8, 2023