diff options
author | parsiya@gmail.com <parsiya@gmail.com> | 2016-04-10 03:58:58 +0300 |
---|---|---|
committer | parsiya@gmail.com <parsiya@gmail.com> | 2016-04-10 03:58:58 +0300 |
commit | a40d7c6a01439ff0592747fd24313c45d955559d (patch) | |
tree | 09e03df48de4cb779acc32686fc0f6a80457aa7b /layouts/partials | |
parent | 0b68aa05b5fc847ccc0474be05e338ab1577d413 (diff) |
Add optional sidebar menu. Fixes #7
Diffstat (limited to 'layouts/partials')
-rw-r--r-- | layouts/partials/sidebar.html | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/layouts/partials/sidebar.html b/layouts/partials/sidebar.html index 4ecd4dc..51085dd 100644 --- a/layouts/partials/sidebar.html +++ b/layouts/partials/sidebar.html @@ -48,6 +48,22 @@ </li> </ul> + <!-- sidebar menu + first we check if it is enabled in config file and then start adding the items --> + + {{ if eq .Site.Params.sidebar_menu_enabled true }} + <section class="odd"> + {{ if isset .Site.Params "sidebar_menu_header" }} + <h1>{{ .Site.Params.sidebar_menu_header }}</h1> + {{ end }} + {{ range .Site.Menus.sidebar }} + <li> + <a href="{{ .URL | absURL }}" title="{{ .Name }}">{{ .Name }}</a> + </li> + {{ end }} + </section> + {{ end }} + <!-- add recent posts - limit is .Site.Params.SidebarRecentLimit - example copied from https://gohugo.io/templates/go-templates/ --> <section class="even"> <h1>Recent Posts</h1> @@ -59,9 +75,9 @@ {{ $.Scratch.Set "numberofrecentposts" .Site.Params.SidebarRecentLimit }} {{ end }} {{ range first ($.Scratch.Get "numberofrecentposts") .Site.Pages }} - <li class="post"> - <a href="{{ .RelPermalink }}">{{ .Title }}</a> - </li> + <li class="post"> + <a href="{{ .RelPermalink }}">{{ .Title }}</a> + </li> {{ end }} </ul> </section> |