1
Fork 0

Nested sections!

This commit is contained in:
Jake Howard 2017-06-13 09:30:46 +01:00
parent 775d517280
commit a59f4719f4
Signed by: jake
GPG key ID: 57AFB45680EDD477
3 changed files with 21 additions and 15 deletions

View file

@ -10,12 +10,13 @@
<span class="image featured main" data-image="{{ .Params.image }}"></span>
{{ end }}
{{ .Content }}
</div>
</div>
{{ end }}
{{ if ne .Params.hide_pages "true" }}
<div class="row">
{{ $parent := . }}
{{ range where .Pages.ByTitle "Params.show_in_nav" "!=" "false" }}
{{ $valid_pages := where .Site.Pages.ByTitle ".Parent" "!=" nil }}
{{ range where $valid_pages ".Parent.UniqueID" $parent.UniqueID }}
{{ if $parent.Params.show_images }}
{{ partial "box_image.html" . }}
{{ else }}

View file

@ -2,20 +2,25 @@
<h1><a href="/">{{ title .Site.Title }}</a></h1>
<nav id="nav">
<ul>
{{ $home := .Site.GetPage "home" }}
{{ range where .Site.Pages.ByTitle "Kind" "section" }}
<li class="top-level">
<a href="{{ .Permalink }}">{{ .LinkTitle }}</a>
{{ if .Pages }}
<ul>
{{ range first .Site.Params.nav_items (where .Pages.ByDate "Params.show_in_nav" "!=" "false") }}
<li><a href="{{ .Permalink }}">{{ .LinkTitle }}</a></li>
{{ end }}
{{ if ge (len .Pages) .Site.Params.nav_items }}
<li><a href="{{ .Permalink }}"><i>See more</i></a></li>
{{ end }}
</ul>
{{ end }}
</li>
{{ if eq .Parent $home }}
{{ $valid_children := where .Site.Pages.ByTitle ".Parent" "!=" nil }}
{{ $children := where $valid_children ".Parent.UniqueID" .UniqueID }}
<li class="top-level">
<a href="{{ .Permalink }}">{{ .LinkTitle }}</a>
{{ if $children }}
<ul>
{{ range first .Site.Params.nav_items $children }}
<li><a href="{{ .Permalink }}">{{ .LinkTitle }}</a></li>
{{ end }}
{{ if ge (len $children) .Site.Params.nav_items }}
<li><a href="{{ .Permalink }}"><i>See more</i></a></li>
{{ end }}
</ul>
{{ end }}
</li>
{{ end }}
{{ end }}
{{ range where .Site.Pages.ByTitle "Kind" "page" }}