To improve SEO a while back removed collections from Shopify URL’s.
This has led to the back button on the page now defaulting to a link that goes to the collections/all.
Is there a way to get product collection to display or trigger the liquid code.
Was trying to add breadcrumbs and it isn’t pulling any collection names.
This is the existing code that bypasses to the else option now:
{% if collection.previous_product %}
{% capture prev_url %}{{ collection.previous_product }}{% endcapture %}
{{ ‘products.general.previous_product_html’ | t | link_to: prev_url }}
{% if collection.next_product %}|{% endif %}
{% endif %}
{% if collection.next_product %}
{% capture next_url %}{{ collection.next_product }}{% endcapture %}
{{ ‘products.general.next_product_html’ | t | link_to: next_url }}
{% endif %}
{% if collection %}
Back to collection
{% else %}
< {{ collections.all.title }}
{% endif %}
This is a basic code using for breadcrumb until realized why wasn’t working (I was testing in older version of live store that still had collections in URL):
{% unless template == ‘index’ or template == ‘cart’ or template == ‘list-collections’ %}
› {{ collection.title }} ›
{{ product.title }}
{% endunless %}
Thanks