Merge pull request #166 from h-enk/doks-breadcrumb-navigation

Add optional breadcrumb trail
This commit is contained in:
Henk Verlinde 2021-03-05 21:23:28 +01:00 committed by GitHub
commit 4a3e093978
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 20 additions and 1 deletions

View File

@ -38,3 +38,8 @@ p.meta {
margin-top: 0.5rem; margin-top: 0.5rem;
font-size: $font-size-base; 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 flexSearch = true
darkMode = true darkMode = true
bootStrapJs = false bootStrapJs = false
breadCrumb = false

View File

@ -15,6 +15,15 @@
{{ else -}} {{ else -}}
<main class="docs-content col-lg-11 col-xl-9 mx-xl-auto"> <main class="docs-content col-lg-11 col-xl-9 mx-xl-auto">
{{ end -}} {{ 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> <h1>{{ .Title }}</h1>
<p class="lead">{{ .Params.lead | safeHTML }}</p> <p class="lead">{{ .Params.lead | safeHTML }}</p>
{{ partial "main/headline-hash.html" .Content }} {{ 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 -}}