Files
cocoa-eh-hugo-theme/layouts/partials/header.html
Michael Noronha 1fa9afaa77 Add option to exclude any headings from navbar
This implementation is somewhat messy, but I think the resulting default
is sane and it allows customizability. The motivation was it felt weird
to me to be linking to a blog, when the home link right above linked to
a slighly different version of the same page.
2018-08-14 23:15:09 -07:00

43 lines
1.9 KiB
HTML

<!DOCTYPE html>
<html lang="{{ .Site.LanguageCode }}">
{{ partial "head.html" . }}
<body>
{{ if (or (.Site.Params.small_banner_logo) (and (.IsPage) (not (.Site.Params.large_banner_logo)))) }}
<div class="header column">
{{ else }}
<div class="header header-home column">
{{ end }}
<div class="container">
{{ if (not (isset .Site.Params "logofile")) }}
<a href="https://github.com/mtn/cocoa-eh-hugo-theme/wiki/Configuration#logo">Logo HOWTO</a>
{{ else if ne .Site.Params.logofile "" }}
<a href="{{ .Site.BaseURL }}"><img class="logo" src="{{ .Site.Params.logofile | absURL }}" alt="logo"></a>
{{ end }}
<div class="content">
<a href="{{ .Site.BaseURL }}"><div class="name"><h1>{{ .Site.Title }}</h1></div></a>
<nav>
<ul>
{{ if (and (ne (len (where .Site.RegularPages "Section" "blog")) 0) (not (in .Site.Params.exclude_headings "blog"))) }}
<li><a href="{{ .Site.BaseURL }}blog/">Blog</a></li>
{{ end }}
{{ range $.Site.Home.Sections }}
{{ range first 1 (where .Pages "Section" "ne" "")}}
{{ if (and (ne .Section "blog") (not (in .Site.Params.exclude_headings (lower .Section))))}}
<li><a href="{{ .Section | urlize | absURL }}">{{ .Section }}</a></li>
{{ end }}
{{ end }}
{{ end }}
{{ range where .Site.RegularPages "Section" ""}}
{{ if (and (and (ne .Title "License") (ne .Title "Home")) (not (in .Site.Params.exclude_headings (lower .Title))))}}
<li><a href="{{ .Permalink }}">{{ .Title }}</a></li>
{{ end }}
{{ end }}
</ul>
</nav>
</div>
</div>
</div>