diff options
author | Li-aung 'Lewis' Yip <liaung@gmail.com> | 2016-12-30 11:05:33 +0300 |
---|---|---|
committer | Li-aung 'Lewis' Yip <liaung@gmail.com> | 2016-12-30 11:05:33 +0300 |
commit | d54dd54428274e095564557e35c3e36f05c1a8fd (patch) | |
tree | 21db4ff565585c3349cfed1036110b055075b83b | |
parent | 15ab57d2998e84166ff95f934141e0b35f6195b6 (diff) |
Add config switch to turn off categories listing in top nav menu
-rw-r--r-- | README.md | 7 | ||||
-rw-r--r-- | layouts/partials/navbar.html | 4 |
2 files changed, 10 insertions, 1 deletions
@@ -46,7 +46,12 @@ copyright = "Copyright (c) 2008 - 2014, Steve Francia; all rights reserved." [params] highlight="Assign a syntax highlight style" - + + # Controls what items are listed in the top nav menu + # "none", or "categories" + # If you have too many categories to fit in the top nav menu, set this to "none" + topmenu="categories" + [author] name = "Steve Francia" github = "spf13" diff --git a/layouts/partials/navbar.html b/layouts/partials/navbar.html index 8e77c72..bdb1c0a 100644 --- a/layouts/partials/navbar.html +++ b/layouts/partials/navbar.html @@ -5,11 +5,13 @@ {{ $baseurl := .Site.BaseURL }} <a href="{{$baseurl}}" class="site-title pure-menu-heading">{{ .Site.Title }}</a> <ul class="pure-menu-list"> + {{ if eq .Site.Params.topmenu "categories" }} {{ range $name,$page := .Site.Taxonomies.categories }} <li class="pure-menu-item"> <a href="{{ $baseurl }}categories/{{ $name | urlize }}" class="pure-menu-link">{{ $name | title }}</a> </li> {{ end }} + {{ end }} <li class="pure-menu-item"> <a href="{{ $baseurl }}about/" class="pure-menu-link">About</a> </li> @@ -20,11 +22,13 @@ <a href="#" id="toggle-btn">☰</a> <ul class="pure-menu-list" id="toggle-content" style="display:none;"> {{ $baseurl := .Site.BaseURL }} + {{ if eq .Site.Params.topmenu "categories" }} {{ range $name,$page := .Site.Taxonomies.categories }} <li class="pure-menu-item"> <a href="{{ $baseurl }}categories/{{ $name | urlize }}" class="pure-menu-link">{{ $name | title }}</a> </li> {{ end }} + {{ end }} <li class="pure-menu-item"> <a href="{{ .Site.BaseURL }}about" class="pure-menu-link">About</a> </li> |