{{ template "structure-menu" (dict "currentLevel" $.Site "currentPage" .Page "level" 0 ) }} {{ define "structure-menu" }} {{ $level := .level }} {{ $currentLevel := .currentLevel }} {{ $currentPage := .currentPage }} {{ $children := .currentLevel.Sections }} {{ if $currentLevel.Pages }} {{ range $currentLevel.Pages }} {{ if not (eq 0 $level) }} {{ $children = $children | append . }} {{ else }} {{ if and ( eq .Section "" ) ( not .IsHome ) }} {{ $children = $children | append . }} {{ end }} {{ end }} {{ end }} {{ end }} {{ $url := "#" }} {{ if gt $level 0 }} {{ $url = $currentLevel.Permalink }} {{ else }} {{ $url = $currentLevel.BaseURL }} {{ end }} {{ $currentLevel.Title }} {{ if $children }}