Hi guys,
I’m using the Prestige theme on my website. The theme has breadcrumbs on category pages, but not product pages. I added a piece of code to the main-product.liquid file that displayed the breadcrumbs (please see the code below).
The problem is that the product belongs to a few categories. It apparently reates confusion for the code, so the breadcrumbs link skips the category name and shows just s blank space there in the format like:
Home / Shop / / Product
Wonder if there is a way I can define and display a category name in the breadcrumb?
The code I used for the product page:
<div class="breadcrumb">
{%- capture collection_breadcrumb -%}
<nav class="breadcrumb breadcrumb--floating" aria-label="{{ 'general.breadcrumb.label' | t | escape }}">
<ol class="breadcrumb__list unstyled-list">
<li class="breadcrumb__list-item">
<a href="{{ routes.root_url }}" class="smallcaps {% unless show_image %}link-faded{% endunless %}">{{ 'general.breadcrumb.home' | t }}</a>
</li>
<li class="breadcrumb__list-item">
<a href="{{ routes.all_products_collection_url }}" class="smallcaps {% unless show_image %}link-faded{% endunless %}">{{ 'general.breadcrumb.shop' | t }}</a>
</li>
<li class="breadcrumb__list-item">
<a href="{{ collection.url }}" aria-current="page" class="smallcaps {% unless show_image %}link-faded{% endunless %}">{{ collection.title }}</a>
</li>
<li class="breadcrumb__list-item">
<a href="{{ product.url }}" aria-current="page" class="smallcaps {% unless show_image %}link-faded{% endunless %}">{{ product.title }}</a>
</li>
</ol>
</nav>
{%- endcapture -%}
<collection-banner {% if section.settings.reveal %}reveal-on-scroll="true"{% endif %} class="collection-banner color-scheme color-scheme--{{ section.settings.color_scheme.id }}" {% if section.settings.allow_transparent_header %}allow-transparent-header{% endif %}>
{%- unless section.settings.allow_transparent_header -%}
{{- collection_breadcrumb -}}
{%- endunless -%}
