From 212f21c524b92e7af9d72b06b008e5aafcd93b3d Mon Sep 17 00:00:00 2001 From: Darshan Baral Date: Fri, 5 Jun 2020 21:49:03 -0700 Subject: added breadcrumb --- layouts/_default/single.html | 6 +++--- layouts/partials/breadcrumb.html | 24 ++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 3 deletions(-) create mode 100644 layouts/partials/breadcrumb.html diff --git a/layouts/_default/single.html b/layouts/_default/single.html index f4bc9b6..01dfbea 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -1,10 +1,10 @@ {{ define "main" }}
- {{ (.Site.GetPage .Section).Title | markdownify }} + {{- partial "breadcrumb" . -}}

{{ .Title }}

diff --git a/layouts/partials/breadcrumb.html b/layouts/partials/breadcrumb.html new file mode 100644 index 0000000..d7a9bb1 --- /dev/null +++ b/layouts/partials/breadcrumb.html @@ -0,0 +1,24 @@ +
+ {{ template "breadcrumbnav" (dict "p1" . "p2" .) }} +
+ +{{ define "breadcrumbnav" }} +{{ if .p1.Parent }} +{{ template "breadcrumbnav" (dict "p1" .p1.Parent "p2" .p2 ) }} +{{ else if not .p1.IsHome }} +{{ template "breadcrumbnav" (dict "p1" .p1.Site.Home "p2" .p2 ) }} +{{ end }} + + + {{- if .p1.Parent }} / {{ end -}} + {{- if .p1.IsHome -}} + + {{- else -}} + {{- .p1.Title | markdownify | truncate 15 -}} + {{- end -}} + +{{ end }} -- cgit v1.2.3