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
This commit is contained in:
George Cushen committed 2022-11-06 16:38:05 +00:00
1 parent a29d4ed136
commit 45466f563a
3 files changed
+10 -4

No files matched your search

@@ -37,7 +37,13 @@
{{ end -}}
<div class="page-header header--fixed">
{{ partial "navbar" . }}
{{/* Load header block */}}
{{ $block_name := .Params.header.navbar.block | default site.Params.header.navbar.block | default "navbar" }}
{{ $block_path := printf "components/headers/%s.html" $block_name }}
{{ if not (templates.Exists (printf "partials/%s" $block_path)) }}
{{ errorf "Check your `header` config in `params.yaml` and/or front matter. Cannot find header block at `layouts/partials/%s`" $block_path }}
{{ end }}
{{ partial $block_path . }}
</div>
<div class="page-body">
@@ -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 . }}