diff options
| author | Aditya Telange <21258296+adityatelange@users.noreply.github.com> | 2021-02-08 20:28:55 +0530 |
|---|---|---|
| committer | Aditya Telange <21258296+adityatelange@users.noreply.github.com> | 2021-02-08 20:28:55 +0530 |
| commit | 43ddff0fde3948b6e53d5d5c15fdb7cda4e548db (patch) | |
| tree | e3192a3edc0e87768f73e46f23a0ca1003180f0e /layouts/partials/breadcrumbs.html | |
| parent | 65f84d6f197c5212b26289a4b99b8198a582c0d4 (diff) | |
breadcrumb nav as partial
Diffstat (limited to 'layouts/partials/breadcrumbs.html')
| -rw-r--r-- | layouts/partials/breadcrumbs.html | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/layouts/partials/breadcrumbs.html b/layouts/partials/breadcrumbs.html new file mode 100644 index 0000000..5532089 --- /dev/null +++ b/layouts/partials/breadcrumbs.html @@ -0,0 +1,18 @@ +{{- if (.Param "ShowBreadCrumbs")}} +<div class="breadcrumbs"> + {{- $url := replace .Parent.Permalink ( printf "%s" .Site.BaseURL) "" }} + {{- $lang_url := replace $url ( printf "%s" .Lang) "" }} + + <a href="{{ "" | absLangURL }}">{{ i18n "home" | default "Home"}}</a> + {{- range $index, $element := split $lang_url "/" }} + + {{- $.Scratch.Add "path" (printf "%s/" $element )}} + {{- $bc_pg := $.Site.GetPage ($.Scratch.Get "path") -}} + + {{- if (and ($bc_pg) (gt (len . ) 0))}} + {{- print " ยป " | safeHTML -}}<a href="{{ $bc_pg.Permalink }}">{{ $bc_pg.Name }}</a> + {{- end }} + + {{- end }} +</div> +{{- end }} |
