Access a community of over 900,000 Shopify Merchants and Partners and engage in meaningful conversations with your peers.
I'm seeing the following;
My question is, as our products only belong to one collection, is there a way to make the Product shown in the collection page link directly through the Collection page?
i.e. It looks the same however the products displayed link to - .com/products/product-name rather than .com/collections/collection-name/products/product-name
The reason I ask is that from an SEO point of view the internal linking from the collections pages point to the /collections/ URL which is then canonically redirected to /products/ which adds time to crawling the site as well as loses link equity through the redirect.
Solved! Go to the solution
This is an accepted solution.
Hello Aviannah:
This is a great question. Unfortunately, it's not something that is able to be changed. Only handles are able to be adjusted. So you could change what the URL displays the product name to be, but the Shopify generated URLs will stay the same.
Basically, the URL is like breadcrumb navigation. Whatever the route that it takes to get to a product will be shown in the URL. So, in this case, the product was in the collection so it will show /collection/collection-name/products/product-name.
i hope that helped to clarify for you 🙂
Replace the product.url in your collections template or other templates where collection product links are used.
{{ product.url | within: collection }}
and replace with
{{ product.url }}
for example:
Cheers,
Tejas
This is an accepted solution.
Hello Aviannah:
This is a great question. Unfortunately, it's not something that is able to be changed. Only handles are able to be adjusted. So you could change what the URL displays the product name to be, but the Shopify generated URLs will stay the same.
Basically, the URL is like breadcrumb navigation. Whatever the route that it takes to get to a product will be shown in the URL. So, in this case, the product was in the collection so it will show /collection/collection-name/products/product-name.
i hope that helped to clarify for you 🙂
Hi Tejas,
I am trying to achieve the same thing, but cannot find any reference to 'within: collection' in any of the collection template files.
Any clues on where else I can look?
The theme is debut
Many thanks,
Sylvia
It would be in "product-card-grid.liquid" file.
Thank you,
Tejas
Hi Tejas,
Thank you for your quick reply. This file doesn't seem to exist on our theme.
Please see screenshots:
Sorry, my mistake, I've found.
That worked - thank you so much!!
Hey guys, I am using Brooklyn theme, can you tell me which .liquid file can I locate this string?
thanks,
Sean
Found it .. it is within Product-grid-item.liquid🤙
Hi there - appreciate the info but this solution is basically saying there is no solution.
Has anyone found a solution for this? It's VERY important for SEO that the indexed product URL produces a page that includes a link to a designated main collection in the breadcrumbs. Otherwise, the collection pages don't rank as well as they should, and the breadcrumb for the collections cannot be marked-up with schema to appear in SERPs. This is why it's not a good practice to base breadcrumbs on the URL. Collections should be assigned to products, not products assigned to collections, so now we have a potential deal-breaker for us and Shopify.
As I see it, there might be a work-around to this: I noticed the canonical on product pages is set to the /product/ path like this:
https://www.bootycocktails.com/products/discolite-808-light-up-stripper-shoes-by-pleaser-shoes
...but, we would prefer to have the canonical set to the URL that includes a primary collection, like this:
In that way, the page that includes the breadcrumb we want indexed will be included, it will appear in SERPs with schema markup, and Google will see the internal link to the desired "parent" collection.
Any way to do this in Shopify, or should I just give up?
Thank you!
Might have found a canonical tag solution for this:
I'll post how it works out.
Hi Mike,
Did you have any success?
Cheers,
Jake
Hey @Mike50 , I think you might be able to do the reverse of what @Tejas_Nadpara said on the first page of this thread.
**NOTE: I am a fairly new Shopify partner (I started so I could do some front-end dev on my own company's store), so please back up / establish version control first if you decide to try my below advice. I'm not an expert yet. ****
So, I'm trying to do the exact opposite as you (route my product URLS as /products/xyz-product instead of /collections/abc-collection/products/xyz-product), because I'm trying to preserve link equity and not split the measured traffic in Google Analytics. So, I applied Tejas' advice of replacing the product.url in the various templates where it appears.
I wanted to REMOVE the collection routing, so I found instances of this in my collections templates:
{{ product.url | within: collection }}
and replaced that with this:
{{ product.url }}
and it worked like a charm.
I wonder if, since you want to ADD the collection routing, you could do the opposite, and find instances of the following syntax in your various pages:
{{ product.url }}
and replace it with this:
{{ product.url | within: collection }}
It's worth a shot! And if that doesn't do it you can always roll it back.
Yeah, I ended up keeping the canonicals as-is because they would cause other issues when items were added to multiple categories (no way to control which category was "canonical"), so just ended up adding breadcrumbs to the template. It's pretty much a hack-job, but a put a bunch of if/then's checking for up to 4 categories then just stringing them together as breadcrumbs along with structured data markup. So far so good, but I would never recommend my coding style! LOL!
Thanks for the help.
Ah, that makes sense. I'll have to keep that in mind when/if we create more than one collection because we will probably run into the same issue as you did. Glad you found a solution that works so far! 👍
Hey Tejas, Our shopify store is using empire theme.
I do not see, these codes in collection template. How this will be done?
Hi Tejas
I am using Debut theme and I cant seem to find this in any file...
{{ product.url | within: collection }}
Any idea which file I would find this in?
I would be in "product-card-grid.liquid" file.
User | RANK |
---|---|
10 | |
9 | |
9 | |
8 | |
8 |