From 14a72fa460a2035bccae1fea43e00b54b7dbe282 Mon Sep 17 00:00:00 2001 From: Christian Olsen <9137189+Chrede88@users.noreply.github.com> Date: Wed, 30 Dec 2020 10:16:47 -0800 Subject: [PATCH] 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) --- wowchemy/assets/scss/wowchemy/_breadcrumb.scss | 15 +++++++++++++++ wowchemy/assets/scss/wowchemy/wowchemy.scss | 1 + wowchemy/i18n/da.yaml | 2 ++ wowchemy/i18n/en.yaml | 3 +++ wowchemy/i18n/es.yaml | 2 ++ wowchemy/layouts/partials/book_layout.html | 8 ++++++++ wowchemy/layouts/partials/breadcrumb.html | 10 ++++++++++ wowchemy/layouts/partials/breadcrumb_helper.html | 12 ++++++++++++ 8 files changed, 53 insertions(+) create mode 100644 wowchemy/assets/scss/wowchemy/_breadcrumb.scss create mode 100644 wowchemy/layouts/partials/breadcrumb.html create mode 100644 wowchemy/layouts/partials/breadcrumb_helper.html diff --git a/wowchemy/assets/scss/wowchemy/_breadcrumb.scss b/wowchemy/assets/scss/wowchemy/_breadcrumb.scss new file mode 100644 index 00000000..ea2df5ec --- /dev/null +++ b/wowchemy/assets/scss/wowchemy/_breadcrumb.scss @@ -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); +} diff --git a/wowchemy/assets/scss/wowchemy/wowchemy.scss b/wowchemy/assets/scss/wowchemy/wowchemy.scss index 5ac025b5..f9402a33 100644 --- a/wowchemy/assets/scss/wowchemy/wowchemy.scss +++ b/wowchemy/assets/scss/wowchemy/wowchemy.scss @@ -20,3 +20,4 @@ @import "dark"; @import "integrations"; @import "rtl"; +@import "breadcrumb"; diff --git a/wowchemy/i18n/da.yaml b/wowchemy/i18n/da.yaml index 4d96a708..21562eef 100644 --- a/wowchemy/i18n/da.yaml +++ b/wowchemy/i18n/da.yaml @@ -6,6 +6,8 @@ translation: På denne side - id: back_to_top translation: Til toppen +- id: home + translation: Hjem - id: related translation: Relaterede - id: minute_read diff --git a/wowchemy/i18n/en.yaml b/wowchemy/i18n/en.yaml index eece784e..b002ee09 100644 --- a/wowchemy/i18n/en.yaml +++ b/wowchemy/i18n/en.yaml @@ -12,6 +12,9 @@ - id: back_to_top translation: Back to top +- id: home + translation: Home + # General - id: related diff --git a/wowchemy/i18n/es.yaml b/wowchemy/i18n/es.yaml index fa41012c..b1472e2d 100644 --- a/wowchemy/i18n/es.yaml +++ b/wowchemy/i18n/es.yaml @@ -8,6 +8,8 @@ translation: En esta página - id: back_to_top translation: Regreso al inicio +- id: home + translation: Inicio # General diff --git a/wowchemy/layouts/partials/book_layout.html b/wowchemy/layouts/partials/book_layout.html index 9ca6100a..ce132901 100644 --- a/wowchemy/layouts/partials/book_layout.html +++ b/wowchemy/layouts/partials/book_layout.html @@ -1,5 +1,9 @@ {{ $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 }} +