# Issues with breadcrumb implementation

**URL:** <https://discourse.gohugo.io/t/issues-with-breadcrumb-implementation/16509>\
**Category:** support\
**Created:** [January 20, 2019, 9:55pm UTC](https://discourse.gohugo.io/t/issues-with-breadcrumb-implementation/16509 "2019-01-20T21:55:01Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![blez](https://avatars.discourse-cdn.com/v4/letter/b/898d66/32.png) [@blez](https://discourse.gohugo.io/u/blez)\
**Post date:** [January 20, 2019, 9:55pm UTC](https://discourse.gohugo.io/t/issues-with-breadcrumb-implementation/16509/1 "2019-01-20T21:55:01Z")

</div>

Hi, i’ve got two different implementations of breadcrumb from this discourse.

```auto
<section class="breadcrumb">
{{ $baseurl := .Site.BaseURL }}
{{ $fullurl := print ( .RelPermalink | replaceRE "[^/]+/$" "") }}
<ul class="breadcrumbs">
  <li><a href="/" class="crumb">home</a></li>
  {{ range $index, $element := split $fullurl "/" }}
    {{ $.Scratch.Add "path" $element }}
      {{ if ne $element "" }}
      <li><a href='{{ $baseurl }}{{ $.Scratch.Get "path" }}'>{{ if isset $.Site.Data.titles . }} {{ index $.Site.Data.titles . }} {{ else }} {{ . }} {{ end }}</a></li>
      {{ $.Scratch.Add "path" "/" }}
      {{ end }}
  {{ end }}
  <li>{{ lower .Title }}</li>
</ul>
</section>

```

```auto
<section class="breadcrumb">
  {{ $url := replace .Permalink ( printf "%s" .Site.BaseURL) "" }}
  {{ $.Scratch.Add "path" .Site.BaseURL }}
  {{ $.Scratch.Add "currentURL" .URL }}
  <ul>
      <li><a href="{{ .Site.BaseURL }}">home</a></li>
      {{ range $index, $element := split $url "/" }}
          {{ $.Scratch.Add "path" $element }}
          {{ $.Scratch.Add "path" "/" }}
          <!-- Check if the current list item is the last one -->
          {{ $isLast := eq ($.Scratch.Get "path") $.Permalink }}
          {{ if ne $element "" }}
              {{ if and (not $isLast) }}
                <li><a href='{{ $.Scratch.Get "path" }}'>{{ . }}</a></li>
              {{ else }}
                <li>{{ lower $.Title }}</li>
              {{ end }}
          {{ end }}
      {{ end }}
  </ul>
</section>

```

Take this path for example:  
`/home/section1`

WIth the first implementation i’ve got the last section repeated:

```auto
<a href="http://localhost:1313/section1/section1">section1</a>

```

With the second one:

```auto
<a href="http://localhost:1313/section1/subsection1//http://localhost:1313/section1/">section1</a>

```

The weird thing is, whenever I edit something from the partial snippet code… it gets fixed.  
Could it be something from the `hugo server -D` itself?
