X-Git-Url: https://git.danix.xyz/?a=blobdiff_plain;f=layouts%2Fpartials%2Fbreadcrumbs.html;fp=layouts%2Fpartials%2Fbreadcrumbs.html;h=fd8cc6bdfc18aff40df2dfb6b7131ae482c5609a;hb=d862564bc2609461aad794ae1e26b5db875f8eee;hp=0000000000000000000000000000000000000000;hpb=35262beb572a1140f9405a2d7d18d5c72dd4006a;p=theme-danix.xyz.git diff --git a/layouts/partials/breadcrumbs.html b/layouts/partials/breadcrumbs.html new file mode 100644 index 0000000..fd8cc6b --- /dev/null +++ b/layouts/partials/breadcrumbs.html @@ -0,0 +1,28 @@ +
    + {{- /* 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 */}} + +
  4. +
\ No newline at end of file