mirror of
https://github.com/gcushen/hugo-academic.git
synced 2025-07-26 03:00:50 +02:00
feat: add support for breadcrumb navigation (#2009)
Adds support for breadcrumb navigation on Book pages. Consider this feature experimental for now as it may still change. Add the following to bottom of `params.toml` to use: ``` [breadcrumb] page_types = {book = true} ``` Future work: prefix link title with page icon when set in order to be consistent with Book menu links (https://github.com/wowchemy/wowchemy-hugo-modules/pull/2009#discussion_r549530364)
This commit is contained in:
parent
219b05cbd2
commit
14a72fa460
8 changed files with 53 additions and 0 deletions
15
wowchemy/assets/scss/wowchemy/_breadcrumb.scss
Normal file
15
wowchemy/assets/scss/wowchemy/_breadcrumb.scss
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
.breadcrumb {
|
||||||
|
font-size: 14px;
|
||||||
|
padding: 0rem;
|
||||||
|
background-color: transparent;
|
||||||
|
border-radius: 0rem;
|
||||||
|
margin-bottom: 0rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.breadcrumb-item.active {
|
||||||
|
color: rgba(0, 0, 0, 0.54);
|
||||||
|
}
|
||||||
|
|
||||||
|
.dark .breadcrumb-item.active {
|
||||||
|
color: rgba(255, 255, 255, 0.54);
|
||||||
|
}
|
|
@ -20,3 +20,4 @@
|
||||||
@import "dark";
|
@import "dark";
|
||||||
@import "integrations";
|
@import "integrations";
|
||||||
@import "rtl";
|
@import "rtl";
|
||||||
|
@import "breadcrumb";
|
||||||
|
|
|
@ -6,6 +6,8 @@
|
||||||
translation: På denne side
|
translation: På denne side
|
||||||
- id: back_to_top
|
- id: back_to_top
|
||||||
translation: Til toppen
|
translation: Til toppen
|
||||||
|
- id: home
|
||||||
|
translation: Hjem
|
||||||
- id: related
|
- id: related
|
||||||
translation: Relaterede
|
translation: Relaterede
|
||||||
- id: minute_read
|
- id: minute_read
|
||||||
|
|
|
@ -12,6 +12,9 @@
|
||||||
- id: back_to_top
|
- id: back_to_top
|
||||||
translation: Back to top
|
translation: Back to top
|
||||||
|
|
||||||
|
- id: home
|
||||||
|
translation: Home
|
||||||
|
|
||||||
# General
|
# General
|
||||||
|
|
||||||
- id: related
|
- id: related
|
||||||
|
|
|
@ -8,6 +8,8 @@
|
||||||
translation: En esta página
|
translation: En esta página
|
||||||
- id: back_to_top
|
- id: back_to_top
|
||||||
translation: Regreso al inicio
|
translation: Regreso al inicio
|
||||||
|
- id: home
|
||||||
|
translation: Inicio
|
||||||
|
|
||||||
# General
|
# General
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,9 @@
|
||||||
{{ $current_page := . }}
|
{{ $current_page := . }}
|
||||||
|
|
||||||
|
{{/* Check whether to show breadcrumb navigation. */}}
|
||||||
|
{{ $breadcrumb_page_types := site.Params.breadcrumb.page_types | default dict }}
|
||||||
|
{{ $show_breadcrumb := index $breadcrumb_page_types .Type | default false }}
|
||||||
|
|
||||||
<div class="container-fluid docs">
|
<div class="container-fluid docs">
|
||||||
<div class="row flex-xl-nowrap">
|
<div class="row flex-xl-nowrap">
|
||||||
<div class="col-12 col-md-3 col-xl-2 docs-sidebar">
|
<div class="col-12 col-md-3 col-xl-2 docs-sidebar">
|
||||||
|
@ -24,6 +28,10 @@
|
||||||
<article class="article">
|
<article class="article">
|
||||||
|
|
||||||
<div class="docs-article-container">
|
<div class="docs-article-container">
|
||||||
|
{{ if $show_breadcrumb }}
|
||||||
|
{{ partial "breadcrumb" $current_page }}
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
<h1>{{ .Title }}</h1>
|
<h1>{{ .Title }}</h1>
|
||||||
|
|
||||||
<div class="article-style">
|
<div class="article-style">
|
||||||
|
|
10
wowchemy/layouts/partials/breadcrumb.html
Normal file
10
wowchemy/layouts/partials/breadcrumb.html
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
{{ if not .IsHome }}
|
||||||
|
<nav aria-label="breadcrumb">
|
||||||
|
<ol class="breadcrumb">
|
||||||
|
{{ partial "breadcrumb_helper" . }}
|
||||||
|
<li class="breadcrumb-item active" aria-current="page">
|
||||||
|
{{ (.LinkTitle | default .Title) | emojify }}
|
||||||
|
</li>
|
||||||
|
</ol>
|
||||||
|
</nav>
|
||||||
|
{{ end }}
|
12
wowchemy/layouts/partials/breadcrumb_helper.html
Normal file
12
wowchemy/layouts/partials/breadcrumb_helper.html
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
{{ with .Parent }}
|
||||||
|
{{ partial "breadcrumb_helper" . }}
|
||||||
|
<li class="breadcrumb-item">
|
||||||
|
<a href="{{ .RelPermalink }}">
|
||||||
|
{{ if .IsHome }}
|
||||||
|
{{ i18n "home" | default "Home" }}
|
||||||
|
{{ else }}
|
||||||
|
{{ (.LinkTitle | default .Title) | emojify }}
|
||||||
|
{{ end }}
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
{{ end }}
|
Loading…
Add table
Add a link
Reference in a new issue