Skip to content

Instantly share code, notes, and snippets.

{% assign t = template | split: '.' | first %}
<nav class="breadcrumbs" aria-label="breadcrumbs">
<ol>
<li>
<a href="/" title="Home">Home</a>
</li>
{% case t %}
{% when 'page' %}
@blueprintmrk
blueprintmrk / settings_schema.json
Created September 11, 2020 17:34 — forked from shopifypartners/settings_schema.json
Theme settings to show and hide accessible breadcrumb snippet - https://www.shopify.com/partners/blog/breadcrumb-navigation
{
"name": "Navigation",
"settings": [
{
"type": "checkbox",
"id": "show_breadcrumb_nav",
"label": "Show breadcrumb navigation"
}
]
},
{% if settings.show_breadcrumb_nav %}
{% include 'breadcrumbs' %}
{% endif %}
.breadcrumbs {
font-size: .85em;
margin: 0 0 2em;
}
.breadcrumbs ol {
list-style-type: none;
margin: 0;
padding: 0;
}
{% unless template == 'index' or template == 'cart' or template == 'list-collections' or template == '404' %}
{% assign t = template | split: '.' | first %}
<nav class="breadcrumbs" role="navigation" aria-label="breadcrumbs">
<ol>
<li>
<a href="/" title="Home">Home</a>
</li>
@blueprintmrk
blueprintmrk / accessible-breadcrumbs-unless.liquid
Created September 11, 2020 17:34 — forked from shopifypartners/accessible-breadcrumbs-unless.liquid
Exclude breadcrumb snippet from rendering on specific templates using unless statement - https://www.shopify.com/partners/blog/breadcrumb-navigation
{% unless template == 'index' or template == 'cart' or template == 'list-collections' or template == '404' %}
{% comment %} snippet code goes here {% endcomment %}
{% endunless %}
{% when 'article' %}
<li>{{ blog.title | link_to: blog.url }}</li>
<li>
<a href="{{ article.url }}" aria-current="page">{{ article.title }}</a>
</li>
{% when 'blog' %}
{% if current_tags %}
<li>{{ blog.title | link_to: blog.url }}</li>
<li>
{% capture tag_url %}{{blog.url}}/tagged/{{ current_tags | join: "+" }}{% endcapture %}
<a href="{{ tag_url }}" aria-current="page">{{ current_tags | join: " + " }}</a>
</li>
{% else %}
<li>
{% 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>
{% when 'product' %}
{% if collection.url %}
<li>
{{ collection.title | link_to: collection.url }}
</li>
{% endif %}
<li>
<a href="{{ product.url }}" aria-current="page">{{ product.title }}</a>