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.
This commit is contained in:
Michael Noronha
2018-08-14 23:15:09 -07:00
parent 498265ba76
commit 1fa9afaa77

View File

@@ -20,18 +20,18 @@
<a href="{{ .Site.BaseURL }}"><div class="name"><h1>{{ .Site.Title }}</h1></div></a>
<nav>
<ul>
{{ if ne (len (where .Site.RegularPages "Section" "blog")) 0 }}
<li><a href="{{ .Site.BaseURL }}blog/">Blog</a></li>
{{ 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 ne .Section "blog"}}
{{ 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 (ne .Title "License") (ne .Title "Home")}}
{{ 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 }}