Advertisement
Guest User

Code breadcrumbs

a guest
Jun 27th, 2021
311
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 4.06 KB | None | 0 0
  1. {%- unless template == 'index' -%}
  2.   <div class="breadcrumb">
  3.     <div class="conainer-fluid">
  4.       <ul class="breadcrumbs">
  5.         <li itemscope>
  6.           <a href="{{ shop.url }}" title="{{ shop.name | escape }}" itemprop="url">
  7.             <span itemprop="title">Home</span>
  8.           </a>
  9.         </li>
  10.         {%- if template contains 'page' -%}
  11.           <li itemscope>
  12.             <a href="{{ shop.url }}{{ page.url }}" title="{{ page.title | escape }}" itemprop="url">
  13.               <span itemprop="title">{{ page.title }}</span>
  14.             </a>
  15.           </li>
  16.         {%- elsif template contains 'product' -%}
  17.           {%- if collection.url -%}
  18.             <li itemscope>
  19.               <a href="{{ shop.url }}{{ collection.url }}" title="{{ collection.title | escape }}" itemprop="url">
  20.                 <span itemprop="title">{{ collection.title }}</span>
  21.               </a>
  22.             </li>
  23.           {%- endif -%}
  24.           <li itemscope>
  25.             <a href="{{ shop.url }}{{ collection.url }}{{ product.url }}" title="{{ product.title | escape }}" itemprop="url">
  26.               <span itemprop="title">{{ product.title }}</span>
  27.             </a>
  28.           </li>
  29.         {%- elsif template contains 'collection' -%}
  30.           {%- assign collection_url = collection.url -%}
  31.           {%- if collection_url == blank or collection_url == '' -%}
  32.             {%- assign collection_url = canonical_url | remove: shop.url -%}
  33.           {%- endif -%}
  34.           <li itemscope>
  35.             <a href="{{ shop.url }}{{ collection_url }}" title="{{ collection.title | escape }}" itemprop="url">
  36.               <span itemprop="title">
  37.                 {%- if collection.handle == 'all' -%}
  38.                   Collection All
  39.                 {%- else -%}
  40.                   {{ collection.title }}
  41.                 {%- endif -%}
  42.               </span>
  43.             </a>
  44.           </li>
  45.         {%- elsif template contains 'blog' -%}
  46.           <li itemscope>
  47.             <a href="{{ shop.url }}{{ blog.url }}" title="{{ blog.title | escape }}" itemprop="url">
  48.               <span itemprop="title">{{ blog.title }}</span>
  49.             </a>
  50.           </li>
  51.         {%- elsif template contains 'article' -%}
  52.           {%- if blog -%}
  53.             <li itemscope>
  54.               <a href="{{ shop.url }}{{ blog.url }}" title="{{ blog.title | escape }}" itemprop="url">
  55.                 <span itemprop="title">{{ blog.title }}</span>
  56.               </a>
  57.             </li>
  58.           {%- endif -%}
  59.           <li itemscope>
  60.             <a href="{{ shop.url }}{{ article.url }}" title="{{ article.title | escape }}" itemprop="url">
  61.               <span itemprop="title">{{ article.title }}</span>
  62.             </a>
  63.           </li>
  64.         {%- elsif template contains 'cart' -%}
  65.           <li itemscope>
  66.             <a href="{{ shop.url }}/cart" itemprop="url">
  67.               <span itemprop="title">Cart</span>
  68.             </a>
  69.           </li>
  70.         {%- elsif template == 'customers/account' -%}
  71.           <li itemscope>
  72.             <a href="{{ shop.url }}/account" itemprop="url">
  73.               <span itemprop="title">Account</span>
  74.             </a>
  75.           </li>
  76.         {%- elsif template == 'customers/order' -%}
  77.           <li itemscope>
  78.             <a href="{{ canonical_url }}" itemprop="url">
  79.               <span itemprop="title">Order</span>
  80.             </a>
  81.           </li>
  82.         {%- elsif template == 'customers/addresses' -%}
  83.           <li itemscope itemtype="http://data-vocabulary.org/Breadcrumb">
  84.             <a href="{{ shop.url }}/account/addresses" title="{{ 'customer.addresses.title' | t | escape }}" itemprop="url">
  85.               <span itemprop="title">Addresses</span>
  86.             </a>
  87.           </li>
  88.         {%- else -%}
  89.           <li itemscope itemtype="http://data-vocabulary.org/Breadcrumb">
  90.             <a href="{{ shop.url }}{{ page.url }}" title="{{ page.title | escape }}" itemprop="url">
  91.               <span itemprop="title">{{ page.title }}</span>
  92.             </a>
  93.           </li>
  94.         {%- endif -%}
  95.       </ul>
  96.     </div>
  97.   </div>
  98. {%- endunless -%}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement