Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make header configurable #352

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
7 changes: 7 additions & 0 deletions exampleSite/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,13 @@ disableHugoGeneratorInject = false
"Made with &#10084; by <a href=\"https://github.com/rhazdon\">Djordje Atlialp</a>"
]

# Custom header
[params.header]
# Set true to hide header on homepage
disableHeaderOnHome = false
# Add names to render additional CSS classes on <header> element
headerCssClasses = [ "" ]

# Colors for favicons
#
[params.favicon.color]
Expand Down
4 changes: 3 additions & 1 deletion layouts/partials/header.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<header class="header">
{{ if not (or .Params.disableHeader (and .Site.Params.header.disableOnHome .IsHome)) }}
<header class="header {{ if .Site.Params.header.cssClasses }}{{ range .Site.Params.header.cssClasses }} {{ . }}{{ end }}">
<span class="header__inner">
{{ partial "logo.html" . }}

Expand All @@ -19,3 +20,4 @@
</span>
</span>
</header>
{{ end }}