Skip to content

Instantly share code, notes, and snippets.

@budparr
Created January 12, 2017 14:33
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save budparr/e00b164bf4a54ca2cffa04bdf6e63aba to your computer and use it in GitHub Desktop.
Save budparr/e00b164bf4a54ca2cffa04bdf6e63aba to your computer and use it in GitHub Desktop.
{{ $url := replace .Permalink ( printf "%s" .Site.BaseURL) "" }}
{{ $.Scratch.Add "path" .Site.BaseURL }}
<ol class="breadcrumbs">
<li><a href="/">home</a></li>
{{ range $index, $element := split $url "/" }}
{{ $.Scratch.Add "path" $element }}
{{ if ne $element "" }}
<li><a href='{{ $.Scratch.Get "path" }}'>{{ . }}</a></li>
{{ $.Scratch.Add "path" "/" }}
{{ end }}
{{ end }}
</ol>
@pritammeta
Copy link

It displays list but breadcrumbs are not list

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment