Breadcrumbs since Hugo v0.109.0



Reading time: 1 minute

This is a true gem by Joe Mooring:

Generating a trail of breadcrumbs became much simpler with Hugo v0.109.0 and later. Use the .Ancestors method on .Page.

<ul id="breadcrumbs">
    {{- range .Ancestors.Reverse }}
        <li><a href="{{ .RelPermalink }}">{{ .Title }}</a></li>
    {{- end }}
    <li><a href="{{ .RelPermalink }}">{{ .Title }}</a></li>
</ul>

UPDATED 2023-03-06: You can find this code now also in the breadcrumbs add-on.

Joost van der Schee