Lego2012
8/21/2017 - 7:25 AM

Implementing Breadcrumb Navigation

Implementing Breadcrumb Navigation

{{ define "breadcrumb" }}
 {{ if .currentPage.Parent }}
   {{ if ne .currentPage.Parent .IsHome }}
      {{ template "breadcrumb" dict "currentPage" .currentPage.Parent }}
    {{ end }}
      {{ if eq .id .currentPage.UniqueID }}
        {{ .currentPage.Title }}
      {{ else }}
        <a href="{{ .currentPage.URL }}">{{ .currentPage.Title }}</a> >
      {{ end }}
  {{ end }}
{{ end }}
<span class="breadcrumb">
  <a href="/">Custom Homepage Title</a>
  {{ template "breadcrumb" dict "currentPage" .Page "id" .UniqueID }}
</span>