1
Fork 0
theorangeone.net-legacy/layouts/partials/navbar/sections.html

35 lines
1.3 KiB
HTML
Raw Normal View History

2017-09-23 14:53:17 +01:00
{{ $valid_children := where (where .Site.Pages ".Parent" "!=" nil) ".Params.hide_in_nav" "!=" "true" }}
{{ $home := .Site.GetPage "home" }}
{{ range where .Site.Pages.ByTitle "Kind" "section" }}
{{ if eq .Parent $home }}
{{ $sorted_pages := sort $valid_children (default "Title" .Params.sort_by) (default "asc" .Params.sort_order)}}
{{ $children := where $sorted_pages ".Parent.UniqueID" .UniqueID }}
<li class="top-level">
{{ partial "navbar/link-item.html" . }}
{{ if $children }}
<ul>
{{ range first .Site.Params.nav_items $children }}
<li>
{{ partial "navbar/link-item.html" . }}
{{ $children := where $sorted_pages ".Parent.UniqueID" .UniqueID }}
{{ if $children }}
<ul>
{{ range first .Site.Params.nav_items $children }}<li>{{ partial "navbar/link-item.html" . }}</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 }}
{{ if ge (len $children) .Site.Params.nav_items }}
<li><a href="{{ .Permalink }}"><i>See more</i></a></li>
{{ end }}
</ul>
{{ end }}
</li>
{{ end }}
{{ end }}