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> <span class="image featured main" data-image="{{ .Params.image }}"></span>
{{ end }} {{ end }}
{{ .Content }} {{ .Content }}
</div> </div>
{{ end }} {{ end }}
{{ if ne .Params.hide_pages "true" }} {{ if ne .Params.hide_pages "true" }}
<div class="row"> <div class="row">
{{ $parent := . }} {{ $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 }} {{ if $parent.Params.show_images }}
{{ partial "box_image.html" . }} {{ partial "box_image.html" . }}
{{ else }} {{ else }}

View file

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