From 99f53a386e5a80a9941746984367c03c0a6c5c0e Mon Sep 17 00:00:00 2001 From: BBaoVanC Date: Tue, 2 Nov 2021 16:51:07 -0500 Subject: [PATCH] Add breadcrumb nav and show active navbar item --- assets/css/bobastyle.css | 24 +++++++++++++++++++++++- layouts/_default/baseof.html | 4 ++++ layouts/partials/breadcrumb.html | 19 +++++++++++++++++++ layouts/partials/top.html | 19 ++++++++++--------- 4 files changed, 56 insertions(+), 10 deletions(-) create mode 100644 layouts/partials/breadcrumb.html diff --git a/assets/css/bobastyle.css b/assets/css/bobastyle.css index 42e92f1..2ecffda 100644 --- a/assets/css/bobastyle.css +++ b/assets/css/bobastyle.css @@ -153,7 +153,7 @@ footer { text-decoration: none; } -.langbar-item.selected { +.navbar-item.active, .langbar-item.active { font-weight: bold; } @@ -285,6 +285,28 @@ h1 svg.icon { +/* Breadcrumb navigation */ +.breadcrumb { + margin-top: 40px; + margin-bottom: 20px; + margin-left: 20px; +} + +.breadcrumb ul { + padding: 0; + list-style: none; +} + +.breadcrumb li { + display: inline; +} + +.breadcrumb li+li:before { + content: "ยป" +} + + + /* Print compatibility */ @media print { .top, .section-header-link { diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index 95b8b0a..67a7cff 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -8,6 +8,10 @@ {{ partial "top.html" . }} + {{ if not .IsHome }} + {{ partial "breadcrumb.html" . }} + {{ end }} +
{{- block "main" . }} {{ .Content }} diff --git a/layouts/partials/breadcrumb.html b/layouts/partials/breadcrumb.html new file mode 100644 index 0000000..bc36a3e --- /dev/null +++ b/layouts/partials/breadcrumb.html @@ -0,0 +1,19 @@ + +{{ 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 }} + + {{ if eq .p1 .p2 }} + {{ .p1.Title }} + {{ else }} + {{ .p1.Title }} + {{ end }} + +{{ end }} diff --git a/layouts/partials/top.html b/layouts/partials/top.html index e01ec48..1fcc527 100644 --- a/layouts/partials/top.html +++ b/layouts/partials/top.html @@ -4,24 +4,25 @@ {{ if .Site.IsMultiLingual }} {{ end }}