From 45466f563a8ac2b0dea4d9dd7219e6be5deb3299 Mon Sep 17 00:00:00 2001 From: George Cushen Date: Sun, 6 Nov 2022 16:38:05 +0000 Subject: [PATCH] feat: add support for page-specific headers (navbars) Both site header and footer now use dynamic block system. E.g. for custom header at `layouts/partials/components/headers/simple.html: ``` --- header: navbar: block: simple --- ``` Also, Params.footer.widget changed to Params.footer.block --- modules/wowchemy/layouts/_default/baseof.html | 8 +++++++- .../layouts/partials/{ => components/headers}/navbar.html | 0 modules/wowchemy/layouts/partials/site_footer.html | 6 +++--- 3 files changed, 10 insertions(+), 4 deletions(-) rename modules/wowchemy/layouts/partials/{ => components/headers}/navbar.html (100%) diff --git a/modules/wowchemy/layouts/_default/baseof.html b/modules/wowchemy/layouts/_default/baseof.html index 92d50a0b..75b37fcd 100644 --- a/modules/wowchemy/layouts/_default/baseof.html +++ b/modules/wowchemy/layouts/_default/baseof.html @@ -37,7 +37,13 @@ {{ end -}}
diff --git a/modules/wowchemy/layouts/partials/navbar.html b/modules/wowchemy/layouts/partials/components/headers/navbar.html similarity index 100% rename from modules/wowchemy/layouts/partials/navbar.html rename to modules/wowchemy/layouts/partials/components/headers/navbar.html diff --git a/modules/wowchemy/layouts/partials/site_footer.html b/modules/wowchemy/layouts/partials/site_footer.html index 1602355e..9c59d51d 100644 --- a/modules/wowchemy/layouts/partials/site_footer.html +++ b/modules/wowchemy/layouts/partials/site_footer.html @@ -2,11 +2,11 @@ {{ partial "functions/get_hook" (dict "hook" "footer-start" "context" .) }} - {{/* Load footer widget */}} - {{ $footer_section_name := site.Params.footer.widget | default "minimal" }} + {{/* Load footer block */}} + {{ $footer_section_name := site.Params.footer.block | default "minimal" }} {{ $footer_section_path := printf "components/footers/%s.html" $footer_section_name }} {{ if not (templates.Exists (printf "partials/%s" $footer_section_path)) }} - {{ errorf "Check your `params.yaml`. Cannot find footer widget at `layouts/partials/%s`" $footer_section_path }} + {{ errorf "Check your `params.yaml`. Cannot find footer block at `layouts/partials/%s`" $footer_section_path }} {{ end }} {{ partial $footer_section_path . }}