From ff883ee336e6585a21aee429368f762e4d062f7a Mon Sep 17 00:00:00 2001 From: undergroundwires Date: Sat, 25 Dec 2021 03:25:39 +0100 Subject: [PATCH] Make header configurable Add: - Ability to header on home page. - Ability to add CSS classes on header. - Ability to disable on individual pages with a page parameter. --- README.md | 4 ++++ exampleSite/config.toml | 7 +++++++ layouts/partials/header.html | 4 +++- 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 7b7cf3bfa..426784f49 100644 --- a/README.md +++ b/README.md @@ -90,6 +90,10 @@ paginate = 10 keywords = "homepage, blog" images = [""] + # Configure header / top menu on top of each page + disableHeaderOnHome = false # Hides header on homepage + headerCssClasses = [ "" ] # Append CSS classes to header element + [taxonomies] category = "blog" tag = "tags" diff --git a/exampleSite/config.toml b/exampleSite/config.toml index da7723f4a..6ee295739 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -121,6 +121,13 @@ disableHugoGeneratorInject = false "Made with ❤ by Djordje Atlialp" ] + # Custom header + [params.header] + # Set true to hide header on homepage + disableHeaderOnHome = false + # Add names to render additional CSS classes on
element + headerCssClasses = [ "" ] + # Colors for favicons # [params.favicon.color] diff --git a/layouts/partials/header.html b/layouts/partials/header.html index 46651d4ef..5ec0ef66e 100644 --- a/layouts/partials/header.html +++ b/layouts/partials/header.html @@ -1,4 +1,5 @@ -
+{{ if not (or .Params.disableHeader (and .Site.Params.header.disableOnHome .IsHome)) }} +
{{ partial "logo.html" . }} @@ -19,3 +20,4 @@
+{{ end }} \ No newline at end of file