From 157feeb814e256124fd087f7e5f8d9f942722530 Mon Sep 17 00:00:00 2001 From: BBaoVanC Date: Fri, 1 Oct 2021 20:54:18 -0500 Subject: [PATCH] Add breadcrumb navigation Disabled by default, and you probably want to keep it that way. It doesn't fit in very well with the design currently. I just found it in the Hugo docs and thought I might as well put it in for safe keeping. --- assets/css/bobastyle.css | 24 ++++++++++++++++++++++++ layouts/_default/baseof.html | 15 ++++++++++++++- layouts/partials/breadcrumb.html | 13 +++++++++++++ layouts/partials/header.html | 10 ---------- 4 files changed, 51 insertions(+), 11 deletions(-) create mode 100644 layouts/partials/breadcrumb.html delete mode 100644 layouts/partials/header.html diff --git a/assets/css/bobastyle.css b/assets/css/bobastyle.css index 5b2cbbb..47a5988 100644 --- a/assets/css/bobastyle.css +++ b/assets/css/bobastyle.css @@ -46,3 +46,27 @@ blockquote { border-left: 5px solid #222; padding-left: 10px; } + +/* Breadcrumb Navigation */ +ul.breadcrumb { + padding 10px 16px; + list-style: none; +} + +ul.breadcrumb li { + display: inline; +} + +ul.breadcrumb li a { + text-decoration: none; +} + +ul.breadcrumb li+li:before { + padding: 8px; + content: "/\00a0"; +} + +ul.breadcrumb li.active a { + color: inherit; + text-decoration: none; +} diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index a6bf1d7..836f891 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -4,7 +4,20 @@ {{- partial "head.html" . -}} - {{ partial "header.html" . }} +

+ {{ .Site.Title | markdownify }} +

+ + + + {{ if .Site.Params.breadcrumbnav }} + {{ partial "breadcrumb.html" . }} + {{ end }}
{{- block "main" . }} diff --git a/layouts/partials/breadcrumb.html b/layouts/partials/breadcrumb.html new file mode 100644 index 0000000..46d1aae --- /dev/null +++ b/layouts/partials/breadcrumb.html @@ -0,0 +1,13 @@ + +{{ define "breadcrumbnav" }} +{{ if .p1.Parent }} +{{ template "breadcrumbnav" (dict "p1" .p1.Parent "p2" .p2 ) }} +{{ else if not .p1.IsHome }} +{{ template "breadcrumbnav" (dict "p1" .p1.Site.Home "p2" .p2 ) }} +{{ end }} + + {{ .p1.Title }} + +{{ end }} diff --git a/layouts/partials/header.html b/layouts/partials/header.html deleted file mode 100644 index 14d02cb..0000000 --- a/layouts/partials/header.html +++ /dev/null @@ -1,10 +0,0 @@ -

- {{ .Site.Title | markdownify }} -

- -