breadcrumbs.html 685 B

12345678910111213141516171819
  1. {{- if (.Param "ShowBreadCrumbs") -}}
  2. <div class="breadcrumbs">
  3. {{- $url := replace .Parent.Permalink (printf "%s" site.BaseURL) "" }}
  4. {{- $lang_url := strings.TrimPrefix (printf "%s/" .Lang) $url -}}
  5. <a href="{{ "" | absLangURL }}">{{ i18n "home" | default "Home" }}</a>
  6. {{- $scratch := newScratch }}
  7. {{- range $index, $element := split $lang_url "/" }}
  8. {{- $scratch.Add "path" (printf "%s/" $element )}}
  9. {{- $bc_pg := site.GetPage ($scratch.Get "path") -}}
  10. {{- if (and ($bc_pg) (gt (len . ) 0))}}
  11. {{- print "&nbsp;»&nbsp;" | safeHTML -}}<a href="{{ $bc_pg.Permalink }}">{{ $bc_pg.Name }}</a>
  12. {{- end }}
  13. {{- end -}}
  14. </div>
  15. {{- end -}}