breadcrumbs.html 710 B

123456789101112131415161718
  1. <!-- Adapted from https://discourse.gohugo.io/t/snippet-partial-for-creating-breadcrumbs-uses-bootstrap-4/15426/2 -->
  2. {{ define "breadcrumb" }}
  3. {{ with .Parent }}
  4. {{ template "breadcrumb" . }}
  5. {{ if not .IsHome }}&nbsp;/&nbsp;&nbsp;{{end}}<a href="{{ .RelPermalink }}">{{ if .IsHome }}Home{{ else }}{{.Title}}{{ end }}</a>
  6. {{ end }}
  7. {{ end }}
  8. {{ if not .Params.suppress_breadcrumb }}
  9. {{ if not .IsHome }}
  10. <!-- This cannot be and'ed with the condition above because
  11. `.Parent.IsHome` is nil pointer on the home page -->
  12. {{if not .Parent.IsHome}}
  13. <div class="breadcrumb">
  14. {{ template "breadcrumb" . }}
  15. </div>
  16. {{ end }}
  17. {{ end }}
  18. {{ end }}