2 <ol class=
"crumbs" itemscope
itemtype=
"https://schema.org/BreadcrumbList">
3 {{- /* declare a 'variable' to store the each link position */}}
4 {{- $data := newScratch }}
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}}">
13 <span itemprop=
"name">home
</span>
15 <span itemprop=
"name">{{.Title}}
</span>
18 {{- /* pass the counter value into schema attribute */}}
19 <meta itemprop=
"position" content='{{ $data.Get
"counter"}}'
/>
20 <span class=
"divider"> /
</span>
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"}}'
/>