I would like to remove the collection name from a product URL

Hi

I am using Debut theme. I have 1 collection that is shown on the homepage and has 3 products. I would like to have the URL just show the product not the path via the colleciton, for example it currently looks like

https://www.amisoleil.com.au/collections/frontpage/products/beach-tents

but I would like it to just be https://www.amisoleil.com.au/products/beach-tents

to keep it cleaner

Im just not sure where to make the change

Thank you in advance

Amanda

@Amanda05

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 }}

Cheers,

Tejas

Thank you

I’m having trouble finding that line of code anywhere in my stores theme
(Debut)?

@Amanda05

It should be in Snippets > product-card-grid.liquid file (second line code).

Let me know if you still not able to find it.

Thank you,

Tejas

Amazing THANK YOU!

Hi Tejas! I’m update my Retina theme from 4.3 to 4.6 and it changed my url like before, with the name of collection. Can you help me with the section where I can find the code to edit? Thank you!

EDIT I found the right section with Retina theme 4.6.3. It is: product-thumbnail.liquid

THank you Tejas!

I couldn’t find that in Aries Shopify Theme? Is there any way to remove /collection/ from the product URL structure in Aries Theme

What if I found them in two places, removed them as instructed, and checked every single liquid file for any other occurrence but the internal linking is still pointing to the URLs with /collection/?

Do you have any idea what could be wrong? The theme is DEVL

Hi - I’m trying to accomplish the same with the Prestige template and can’t find {{ product.url | within: collection }} or even {{ product.url }} in any of my snippets, sections, or templates. Any ideas?

Im new to Shopify and using Danw theme. Do you know where I can find {{ product.url | within: collection }} on this theme? It looks they changed product-card-grid.liquid file

did you figure it out?

card-product.liquid

href="{{ card_product.url | within: card_collection }}

search for ‘within: card_collection’, I had it repeating 3 times on the file…removed the ‘| within: card_collection’ part and works fine.

Tried product.card.liquid which also has the url settings but it did not resolve anything on front.

We can remove collections name from URL and customize our URL according to our need for better SEO: