mirror of https://github.com/luizdepra/hugo-coder.git

Gabor Nagy
23.33.2018 0485ff61a406b3e29ad5669a8a1a5f250aafe59c
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.
1 files modified
4 ■■■ changed files
layouts/partials/header.html 4 ●●● patch | view | raw | blame | history
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>