Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save blueprintmrk/8fd405d1c47e63c4785342f37435cefc to your computer and use it in GitHub Desktop.
Save blueprintmrk/8fd405d1c47e63c4785342f37435cefc to your computer and use it in GitHub Desktop.
Case statement for collection template to build accessible breadcrumbs - https://www.shopify.com/partners/blog/breadcrumb-navigation
{% when 'collection' and collection.handle %}
{% if current_tags %}
<li>{{ collection.title | link_to: collection.url }}</li>
<li>
{% capture tag_url %}{{ collection.url }}/{{ current_tags | join: "+"}}{% endcapture %}
<a href="{{ tag_url }}" aria-current="page">{{ current_tags | join: " + "}}</a>
</li>
{% else %}
<li>
<a href="{{ collection.url }}" aria-current="page">{{ collection.title }}</a>
</li>
{% endif %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment