# Breadcrumb gives error when two files in different folders have the same name

**URL:** <https://discourse.gohugo.io/t/breadcrumb-gives-error-when-two-files-in-different-folders-have-the-same-name/42972>\
**Category:** support\
**Created:** [February 15, 2023, 3:39pm UTC](https://discourse.gohugo.io/t/breadcrumb-gives-error-when-two-files-in-different-folders-have-the-same-name/42972 "2023-02-15T15:39:45Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![jmooring](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/jmooring/32/4214_2.png) [@jmooring](https://discourse.gohugo.io/u/jmooring)\
**Post date:** [February 15, 2023, 5:19pm UTC](https://discourse.gohugo.io/t/breadcrumb-gives-error-when-two-files-in-different-folders-have-the-same-name/42972/4 "2023-02-15T17:19:53Z")

</div>

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

```auto
{{- with .Ancestors.Reverse }}
  <nav>
    {{- $p := . | append $ }}
    {{- range $k, $_ := $p }}
      {{- if $k }}
        <span class="breadcrumb-separator">&raquo;</span>
      {{- end }}
      {{- $ariaCurrent := "true" }}
      {{- if eq $k (sub (len $p) 1) }}
        {{- $ariaCurrent = "page" }}
      {{- end }}
      <a aria-current="{{ $ariaCurrent }}" href="{{ .RelPermalink }}">{{ .LinkTitle }}</a>
    {{- end }}
  </nav>
{{- end }}

```

---

_[View the full topic](https://discourse.gohugo.io/t/breadcrumb-gives-error-when-two-files-in-different-folders-have-the-same-name/42972)._
