本文主要是介绍Shopify增加导航栏的方式,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
原文网址:How to Add Breadcrumb Navigation to Your Shopify Store: DIY Tutorial U – EcomExperts
增加导航栏的代码:
{% unless template == 'index' or template == 'cart' or template == 'list-collections' %}<nav class="breadcrumb" role="navigation" aria-label="breadcrumbs"><a href="/" title="Home">Home</a>{% if template contains 'page' %}<span aria-hidden="true">›</span><span>{{ page.title }}</span>{% elsif template contains 'product' %}{% if collection.url %}<span aria-hidden="true">›</span>{{ collection.title | link_to: collection.url }}{% endif %}<span aria-hidden="true">›</span><span>{{ product.title }}</span>{% elsif template contains 'collection' and collection.handle %}<span aria-hidden="true">›</span>{% if current_tags %}{% capture url %}/collections/{{ collection.handle }}{% endcapture %}{{ collection.title | link_to: url }}<span aria-hidden="true">›</span><span>{{ current_tags | join: " + " }}</span>{% else %}<span>{{ collection.title }}</span>{% endif %}{% elsif template == 'blog' %}<span aria-hidden="true">›</span>{% if current_tags %}{{ blog.title | link_to: blog.url }}<span aria-hidden="true">›</span><span>{{ current_tags | join: " + " }}</span>{% else %}<span>{{ blog.title }}</span>{% endif %}{% elsif template == 'article' %}<span aria-hidden="true">›</span>{{ blog.title | link_to: blog.url }}<span aria-hidden="true">›</span><span>{{ article.title }}</span>{% else %}<span aria-hidden="true">›</span><span>{{ page_title }}</span>{% endif %}</nav>{% endunless %}
这篇关于Shopify增加导航栏的方式的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!