{{ range .Site.Menus.main.ByWeight }} {{ $indxfile := .URL | relURL }} {{ $indexExists := fileExists $indxfile }} {{ $indxname := string $indxfile }} {{ $listfile := string .Post }} {{/* $listExists := fileExists $listfile */}} {{ $menuName := .Name }} {{ if $indexExists }} {{ $defaultOpen := string .Pre }} {{ if (eq $defaultOpen "open") }}
{{ $menuName }}
{{ if .Post }} {{ with ($.Site.GetPage $listfile) }}
{{ .Content }}
{{ end }} {{ else }} {{ with ($.Site.GetPage "section" $indxname) }}
{{ .Content }}
{{ end }} {{ end }}
{{ else }}
{{ $menuName }}
{{ if .Post }} {{ with ($.Site.GetPage $listfile) }}
{{ .Content }}
{{ end }} {{ else }} {{ with ($.Site.GetPage "section" $indxname) }}
{{ .Content }}
{{ end }} {{ end }}
{{ end }} {{ else }}
{{- $menuName -}}
{{ end }} {{ end }}