From dcbadc3b6117f23107822d80e2d78a365b3970fe Mon Sep 17 00:00:00 2001 From: Ngô Ngọc Đức Huy Date: Mon, 31 Jul 2023 10:56:54 +0700 Subject: Add recursive TOC and breadcrumbs navigation --- assets/css/theme.css | 31 ++++++++++++++++++++++++++++ layouts/_default/single.html | 4 ++-- layouts/partials/breadcrumbs.html | 14 +++++++++++++ layouts/partials/post-navigation-bottom.html | 1 + layouts/partials/post-navigation-top.html | 2 ++ 5 files changed, 50 insertions(+), 2 deletions(-) create mode 100644 layouts/partials/breadcrumbs.html create mode 100644 layouts/partials/post-navigation-bottom.html create mode 100644 layouts/partials/post-navigation-top.html diff --git a/assets/css/theme.css b/assets/css/theme.css index e659a2d..1988b04 100644 --- a/assets/css/theme.css +++ b/assets/css/theme.css @@ -9,3 +9,34 @@ nav ul, nav ul li { footer { padding-top: 1.5rem; } + +nav.breadcrumb { + padding: 0 .5rem; +} + +.breadcrumb ol { + display: flex; + flex-wrap: wrap; + list-style: none; + text-transform: none !important; + margin: 0; + padding: 0; +} + +.breadcrumb li:not(:last-child)::after { + display: inline-block; + margin: 0 .25rem; + content: "→"; +} + +a.nav-up::before { + content: "↑ "; +} + +a.nav-prev::after { + content: " →" +} + +a.nav-next::before { + content: "← " +} diff --git a/layouts/_default/single.html b/layouts/_default/single.html index d2d60dd..79b493d 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -12,7 +12,7 @@ SPDX-License-Identifier: MIT ({{ i18n "reading time" .ReadingTime }}) {{ partial "post-language-switcher.html" . }} - {{ partial "post-navigation.html" . }} + {{ partial "post-navigation-top.html" . }} {{ .Content }} @@ -20,6 +20,6 @@ SPDX-License-Identifier: MIT {{ partial "single-extra.html" }} - {{ partial "post-navigation.html" . }} + {{ partial "post-navigation-bottom.html" . }} {{ end }} diff --git a/layouts/partials/breadcrumbs.html b/layouts/partials/breadcrumbs.html new file mode 100644 index 0000000..3dc235b --- /dev/null +++ b/layouts/partials/breadcrumbs.html @@ -0,0 +1,14 @@ + diff --git a/layouts/partials/post-navigation-bottom.html b/layouts/partials/post-navigation-bottom.html new file mode 100644 index 0000000..1fcdfb7 --- /dev/null +++ b/layouts/partials/post-navigation-bottom.html @@ -0,0 +1 @@ +{{ partial "post-navigation.html" .}} diff --git a/layouts/partials/post-navigation-top.html b/layouts/partials/post-navigation-top.html new file mode 100644 index 0000000..3bcc39f --- /dev/null +++ b/layouts/partials/post-navigation-top.html @@ -0,0 +1,2 @@ +{{ partial "breadcrumbs.html" .}} +{{ partial "post-navigation.html" .}} -- cgit 1.4.1