Kontextsensivites Menü
{{/* Get the current page's URL so we can compare it to the list below */}}
{{ $currentPageUrl := .URL }}
{{/* Get a list of this section's other pages. "RegularPages" excludes the list page */}}
{{ $currentSection := (where .Site.RegularPages "Section" .Section) }}
{{/* Get the number of entries of $currentSection and subtract 1 */}}
{{ $i := sub ($currentSection | len) 1 }}
{{/* So we can only show this menu if there are one or more other entries */}}
{{ if ge $i 1 }}
<div>
<ul>
<li>{{/* Return the section name, make it readable (humanize) and if there are 2 or more entries, make the section name plural (pluralize). */}}
{{ $i }} More {{ if ge $i 2 }}{{ .Section | humanize | pluralize }}{{ else }}{{ .Section | humanize }}{{end}}
</li>
{{ range $currentSection }}
<li>
{{/* If the URL returned is the same as the current URL dim it so we know that that's the page we're on. NOTE: Should probably use a more accessible way of displaying this. */}}
<a href="{{ .URL }}" class="{{ if eq $currentPageUrl .URL }} klasse{{end}}">
{{ .Title }}
</a>
</li>
{{ end }}
</ul>
</div>
{{ end }}