various fixes, added pagination and articles prev/next links.
[theme-danix.xyz.git] / layouts / partials / breadcrumbs.html
1 <div id="breadcrumbs">
2 <ol class="crumbs" itemscope itemtype="https://schema.org/BreadcrumbList">
3 {{- /* declare a 'variable' to store the each link position */}}
4 {{- $data := newScratch }}
5 <li>You're in: </li>
6 {{- range $index, $value := .Ancestors.Reverse }}
7 <li class="crumb-item" itemprop="itemListElement" itemscope itemtype="https://schema.org/ListItem">
8 {{- /* read the index from loop and add 'one', because it starts counting from zero */}}
9 {{- $data.Set "counter" $index }}
10 {{- $data.Add "counter" 1 }}
11 <a itemprop="item" href="{{.Permalink}}">
12 {{ if .IsHome }}
13 <span itemprop="name">home</span>
14 {{ else }}
15 <span itemprop="name">{{.Title}}</span>
16 {{ end }}
17 </a>
18 {{- /* pass the counter value into schema attribute */}}
19 <meta itemprop="position" content='{{ $data.Get "counter"}}' />
20 <span class="divider"> / </span>
21 </li>
22 {{- end }}
23 <li class="crumb-item active" itemprop="itemListElement" itemscope itemtype="https://schema.org/ListItem">
24 {{- /* add 'one' one more time for the last link position */}}
25 {{- $data.Add "counter" 1 }}
26 <span itemprop="name">{{.Title}}</span>
27 {{- /* pass the counter value into schema attribute */}}
28 <meta itemprop="position" content='{{ $data.Get "counter"}}' />
29 </li>
30 </ol>
31 </div>