diff options
author | Darshan Baral <darshanbaral@gmail.com> | 2020-06-06 07:49:03 +0300 |
---|---|---|
committer | Darshan Baral <darshanbaral@gmail.com> | 2020-06-06 07:49:03 +0300 |
commit | 212f21c524b92e7af9d72b06b008e5aafcd93b3d (patch) | |
tree | 71b78fe4e52949bfc764e3da85b611ca572e08f5 | |
parent | 6607ccf50ebd11f9c4ab64ac28103d5ba61253a4 (diff) |
added breadcrumb
-rw-r--r-- | layouts/_default/single.html | 6 | ||||
-rw-r--r-- | layouts/partials/breadcrumb.html | 24 |
2 files changed, 27 insertions, 3 deletions
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" }}
<div class="mb-2 p-3 shadow position-relative">
<small
- class="bg-white pl-1 pr-1 rounded border border-secondary"
- style="background-color: #f3f3ef !important; position: absolute; top: -0.75em; left: 0.5em"
+ class="bg-white pl-1 pr-1 rounded"
+ style="background-color: #f3f3ef !important; position: absolute; top: -0.75em; right: 1em"
>
- {{ (.Site.GetPage .Section).Title | markdownify }}
+ {{- partial "breadcrumb" . -}}
</small>
<h2>{{ .Title }}</h2>
<div class="rounded">
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 @@ +<div> + {{ template "breadcrumbnav" (dict "p1" . "p2" .) }} +</div> + +{{ 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 }} + +<span style="font-size: 0.9em;"> + {{- if .p1.Parent }} / {{ end -}} + {{- if .p1.IsHome -}} + <i + aria-label="home" + class="fas fa-home" + ></i + > + {{- else -}} + {{- .p1.Title | markdownify | truncate 15 -}} + {{- end -}} +</span> +{{ end }} |