Skip to content

Instantly share code, notes, and snippets.

@xixianykus
Created April 9, 2021 04:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xixianykus/5518d62f2137a57e5e8a6782bafc0121 to your computer and use it in GitHub Desktop.
Save xixianykus/5518d62f2137a57e5e8a6782bafc0121 to your computer and use it in GitHub Desktop.
breadcrumb nav for Hugo

Copy the the following to a partial file. I only just changed the class name. I used CSS to control the layout, add the > symbols.

`

    {{ template "breadcrumbnav" (dict "p1" . "p2" .) }}

{{ define "breadcrumbnav" }} {{ if .p1.Parent }} {{ template "breadcrumbnav" (dict "p1" .p1.Parent "p2" .p2 ) }} {{ else if not .p1.IsHome }} {{ template "breadcrumbnav" (dict "p1" .p1.Site.Home "p2" .p2 ) }} {{ end }} {{ .p1.Title }} {{ end }}`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment