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