All things Shopify and commerce
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.
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
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🤙
Depends on your theme, mine was in:
product-item.liquid
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.
Hi Tejas,
Do you know where this code is located in the responsive theme from out of the sand box?
Thanks in advance.
Hi Tejas,
I am using a Supply theme, in which template do i need to change the code.
Thanks and Regards
BBbySDS
You need to change in Supply theme Snippets > product-grid-item.liquid file.
Thank you,
Tejas
Hi Tejas, Thanks it worked.
Thanks and Regards
BBbySDS
Hi Tejas,
Do you know where this code is located in the responsive theme from out of the sand box?
Thanks in advance.
Hi All,
If anyone reading this. I am lost. I cannot find this {{ product.url | within: collection }}
I am using the IMPULSE theme.
Many thanks
Found in product-thumbnail.liquid
in Parallax theme
I've changed {{ product.url }} to {{product.url | within: collection }} everywhere possible on my site and I can't get this to work properly. I need this to happen, take a look and let me know what I'm missing.
beautifulbystorm.com
Nvm, I got it now.
I would also like for my "Recently Viewed' and 'You May Also Like' products are the last thing I have pointing to /product pages rather than /collections.
If anyone knows how to fix this please reach out. Thanks.
@Tejas_Nadpara Please can you let me know to fix the breadcrumbs issue as you have responded for the earlier message - where can I find the below code in Minimal theme
{{ product.url | within: collection }}
Hi @Tejas_Nadpara !
I'm using the Turbo theme. I have already solve the problem of editing the image links on the collections pages but not the caption underneath the image.
In the Snippets section, I went to >> product-details.liquid
The images all correctly point to the direct product page that has the canonical link.
But directly underneath the image, the captions themselves have the collections/collection-name/products/product-name links.
I don't know where to go to update those caption links.
Go through other snippets... There is some other file, which needs the same code replacement.
Other option is to do search among files
Thanks @korsakov! Found it in the product-thumbnail.liquid file under snippets.
Hi @PaveSEO, your comment helped me to find and change the product-thumbnail.liquid file on Turbo theme.
It fixed the product caption url, and now it's directing to the main product page.
But the thumbnail overlay is not fixed, and pointing to the same old "/collection/product/..." page.
I was wondering if you had faced such issue and keen to know how to fix. Thanks.
Do you know how to do this for themes that use the JSON format? Most of our templates are JSON not "liquid"
@SarahMMoore1our theme uses JSON for "templates" as well. In the product.json for example you can find "type": "main-product". This refers to the main-product.liquid that you can find in "sections"
Hi, I'm using Dawn theme.
I removed a few within: collection codes but my problem was not completely solved.
The files you mentioned are not available in my theme. I wonder how I can remove these codes?
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 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! 👍
From an SEO perspective, this is the opposite of what you actually want to do . The point is to push relevance to the collections pages so that they are your ranking landers for organic traffic. Instead, you are divorcing the products from their respective collections. The canonical should point TO the nested category page. Many ecomm CMS have this same issue because you might want to categorize the same product in multiple places. Generally you can manually set the canonical on the product page, but it seems like Shopify doesn't care that much about SEO optimization.
Shopify really doesn't seem to understand the whole SEO thing. We are being faced with every collection link being a 301 redirect to the canonical link of the products. So now my site audits are showing that every single one of our products has a permanent redirect.
Although using permanent redirects (a 301 or 308 redirect) is appropriate in many situations (for example, when you move a website to a new domain, redirect users from a deleted page to a new one, or handle duplicate content issues), we recommend that you keep them to a reasonable minimum. Every time you redirect one of your website's pages, it decreases your crawl budget, which may run out before search engines can crawl the page you want to be indexed. Moreover, too many permanent redirects can be confusing to users.
Thank you for your help, but isn't it crazy that this happens? I went from 300 visits a day to 30 because of this problem....
Then with each theme update I have to reciprocate everything again... it's quite absurd this situation.
So you recommend that I change everything with product.url and I should solve the problem? As it seems to be just that...
Can I ask you if you can give me a check on the fly on my site https://cartonlineitalia.it ? I use screaming frog and I see that the first entry I get as an error is this one: "Canonical, transformed to canonical"
Thank you very much !
For online store 2.0 theme, how we solve same problem? any one konw this?
I would be also interested if someone solved this with a store 2.0 theme.
We are using Focal theme, and there's no link with this structure in any liquid file: <a href="{{ product.url | within: collection }}“>. But Google indexed links like .com/collections/collection-name/products/product-name. For SEO reasons we only want to have this link structure: .com/products/product-name. I don't understand how this can happen...
Moreover Google indexed links like .com/collections/collection-name/tag. How are these links created? In our former theme the filter on the collection pages worked with tags. But now the filter is working completely different with meta fields like &filter.p.m.my_fields.metafield=value. There is no chance you can click a link like .com/collections/collection-name/tag on the collection page. How can that be indexed by Google?
Thanks for your help!
I found it under Snippets: Card-product.liquid
and this is the URL that needs to be changed.
{{ card_product.url }}
I found it on the card-product.liquid under the {{ card_product.url }} name
Hey Community! As the holiday season unfolds, we want to extend heartfelt thanks to a...
By JasonH Dec 6, 2024Dropshipping, a high-growth, $226 billion-dollar industry, remains a highly dynamic bus...
By JasonH Nov 27, 2024Hey Community! It’s time to share some appreciation and celebrate what we have accomplis...
By JasonH Nov 14, 2024