aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGabor Nagy <Aigeruth@users.noreply.github.com>2018-03-23 13:33:26 +0000
committerLuiz F. A. de PrĂ¡ <luizdepra@users.noreply.github.com>2018-03-23 10:33:26 -0300
commit0485ff61a406b3e29ad5669a8a1a5f250aafe59c (patch)
tree23d3bb5152e44da9162df158bd5db2d4086e653b
parent289c9e0b076e8631347ab096755502d7583bb9ef (diff)
downloadhugo-coder-0485ff61a406b3e29ad5669a8a1a5f250aafe59c.tar.gz
hugo-coder-0485ff61a406b3e29ad5669a8a1a5f250aafe59c.tar.bz2
hugo-coder-0485ff61a406b3e29ad5669a8a1a5f250aafe59c.zip
Make main menu optional. (#1)
Building the site fails if the menu is not defined in the config, because the `header.html` references `.Site.Menus.main`. It can be made optional by using the `with` helper.
-rw-r--r--layouts/partials/header.html4
1 files changed, 3 insertions, 1 deletions
diff --git a/layouts/partials/header.html b/layouts/partials/header.html
index caa698f..34fd729 100644
--- a/layouts/partials/header.html
+++ b/layouts/partials/header.html
@@ -3,12 +3,14 @@
<a class="navigation-title" href="{{ "/" | absURL }}">
{{ .Site.Title }}
</a>
+ {{with .Site.Menus.main}}
<ul class="navigation-list float-right">
- {{ range sort .Site.Menus.main }}
+ {{ range sort . }}
<li class="navigation-item">
<a class="navigation-link" href="{{ .URL }}">{{ .Name }}</a>
</li>
{{ end }}
</ul>
+ {{end}}
</section>
</nav>