Why are breadcrumbs not functioning properly on my website?

Hello,

Breadcrumbs feature is not functioning correctly on the website I am working on.

I tried the below code but it does not work if the product belongs to multiple collections. Please help.

Home / {{ product.type }} / {{ product.title}}
2 Likes

@shettytarun
add this code to the theme.liquid


{%- unless template == 'index' or template == 'cart' or template == 'list-collections' or template == '404' -%}
{%- assign t = template | split: '.' | first -%}

{%- endunless -%}

Thank you.

To get perfect navigation how to add this check out this link.
Click here

Hi,

Thanks for your reply. I tried the code you provided but I am still not able to get the collection in between. I go from home to collection and select the product, the breadcrumbs on product page shows home–> product instead of home-collection name - product.

Kindly help.

Thanks,

Rashmi

It’s actually most beneficial for SEO to have your canonical URL’s the way they are. Unfortunately Shopify’s breadcrumbs become “broken” once you get to the product page. Anyway, to add collections back into the URL upon entering the product page, do the following:

Go to the product-grid-item.liquid

Look for code:

<a href="{{ product.url }}" class="product-grid-item">

Replace it with:

<a href="{{ product.url | within: current_collection }}" class="product-grid-item">