feat: add optional breadcrumb trail

This commit is contained in:
Henk Verlinde 2021-03-05 21:04:55 +01:00
parent 7eeba784db
commit 9c67aca368
4 changed files with 20 additions and 1 deletions

View File

@ -38,3 +38,8 @@ p.meta {
margin-top: 0.5rem;
font-size: $font-size-base;
}
.breadcrumb {
margin-top: 2.25rem;
font-size: $font-size-base;
}

View File

@ -53,3 +53,4 @@ editPage = false
flexSearch = true
darkMode = true
bootStrapJs = false
breadCrumb = false

View File

@ -3,7 +3,7 @@
<div class="col-lg-5 col-xl-4 docs-sidebar">
<nav class="docs-links" aria-label="Main navigation">
{{ partial "sidebar/docs-menu.html" . }}
</nav>
</nav>
</div>
{{ if ne .Params.toc false -}}
<nav class="docs-toc d-none d-xl-block col-xl-3" aria-label="Secondary navigation">
@ -15,6 +15,15 @@
{{ else -}}
<main class="docs-content col-lg-11 col-xl-9 mx-xl-auto">
{{ end -}}
{{ if .Site.Params.options.breadCrumb -}}
<!-- https://discourse.gohugo.io/t/breadcrumb-navigation-for-highly-nested-content/27359/6 -->
<nav aria-label="breadcrumb">
<ol class="breadcrumb">
{{ partial "main/breadcrumb" . -}}
<li class="breadcrumb-item active" aria-current="page">{{ .Title }}</li>
</ol>
</nav>
{{ end }}
<h1>{{ .Title }}</h1>
<p class="lead">{{ .Params.lead | safeHTML }}</p>
{{ partial "main/headline-hash.html" .Content }}

View File

@ -0,0 +1,4 @@
{{ with .Parent -}}
{{ partial "main/breadcrumb.html" . -}}
<li class="breadcrumb-item"><a href="{{ .Permalink }}">{{ if .IsHome }}Home{{ else }}{{ .Title }}{{ end }}</a></li>
{{ end -}}