{{- /* declare a 'variable' to store the each link position */}} {{- $data := newScratch }} {{- range $index, $value := .Ancestors.Reverse }}
  1. {{- /* read the index from loop and add 'one', because it starts counting from zero */}} {{- $data.Set "counter" $index }} {{- $data.Add "counter" 1 }} {{ if .IsHome }} home {{ else }} {{.Title}} {{ end }} {{- /* pass the counter value into schema attribute */}}
  2. {{- end }}
  3. {{- /* add 'one' one more time for the last link position */}} {{- $data.Add "counter" 1 }} {{.Title}} {{- /* pass the counter value into schema attribute */}}