Hi!
I would like my product pages to show home - collection - product in the breadcrumbs but I'm only getting home - product.
A while ago I changed the product pages so the url would not have the collection in the string. I think this may be the cause of the problem...but I can't remember how I did this. I want to keep the urls reading the same way.
https://thelittlepotcompany.co.uk
My products are assigned to collections but it seems the breadcrumb code isn't able to read this?
<a href="/" title="{{ 'general.breadcrumbs.home_link_title' | t }}">{{ 'general.breadcrumbs.home' | t }}</a> {% if template.name == 'product' %} {% if collection %} <span aria-hidden="true" class="breadcrumb__sep">›</span> {% if collection.handle %} {% capture url %}/collections/{{ collection.handle }}{% endcapture %} {{ collection.title | link_to: url }} {% endif %} {% endif %} <span aria-hidden="true" class="breadcrumb__sep">›</span> <span>{{ product.title }} </span>
This is how I worked out how to do it. I guess there must be a more elegant way?
{% for collection in product.collections %} {% if collection.title != "Home page" %} <span aria-hidden="true" class="breadcrumb__sep">›</span> <a href="{{ collection.url }}" title=" {{ collection.title }}""> {{ collection.title }}</a> {% endif %} {% endfor %}
User | Count |
---|---|
431 | |
200 | |
146 | |
57 | |
44 |