{{ 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") }}
    {{ if .Post }} {{ with ($.Site.GetPage $listfile) }}

    {{ .Content }}

    {{ end }} {{ else }} {{ with ($.Site.GetPage "section" $indxname) }}

    {{ .Content }}

    {{ end }} {{ end }}
    {{ else }}
    {{ if .Post }} {{ with ($.Site.GetPage $listfile) }}

    {{ .Content }}

    {{ end }} {{ else }} {{ with ($.Site.GetPage "section" $indxname) }}

    {{ .Content }}

    {{ end }} {{ end }}
    {{ end }} {{ else }} {{ end }} {{ end }}