<head>
  <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"> <link rel="stylesheet" href="{{ .Site.BaseURL }}css/main_menu.css">
  <link rel="stylesheet" href="{{ .Site.BaseURL }}css/postcard.css">
  <script type="text/javascript" src="{{ .Site.BaseURL }}js/main_menu.js"></script>
</head>

<body>


  <ul class="accordion right-side">
    {{ range .Site.Menus.main.ByWeight }}
      {{ $indxfile := .URL | relURL }}
      {{ $indexExists := fileExists $indxfile }}
      {{ $indxname := string $indxfile }}
      {{ $listfile := string .Post }}
      {{/* $listExists := fileExists $listfile */}} <!-- bug?? -->
      {{ $menuName := .Name }}

      {{ $defaultOpen := string .Pre }}

      {{ if .Post }}
        {{ if (eq $defaultOpen "open") }}
	  <button class="button active">{{ $menuName }}</button>
	  <div class="nest">
	    {{ with ($.Site.GetPage $listfile) }}
	      <p>{{ .Content }}</p>
	    {{ end }}
	  </div>
	{{ else }}
	  <button class="button">{{ $menuName }}</button>
	  <div class="nest" style="display: none;">
            {{ with ($.Site.GetPage $listfile) }}
	      <p>{{ .Content }}</p>
	    {{ end }}
	  </div>
	{{ end }}
      {{ else if $indexExists }}
        {{ if (eq $defaultOpen "open") }}
	  <button class="button active">{{ $menuName }}</button>
	  <div class="nest">
	    {{ with ($.Site.GetPage "section" $indxname) }}
	      <p>{{ .Content }}</p>
	    {{ end }}
	  </div>
	{{ else }}
	  <button class="button">{{ $menuName }}</button>
	  <div class="nest" style="display: none;">
            {{ with ($.Site.GetPage "section" $indxname) }}
	      <p>{{ .Content }}</p>
	    {{ end }}
	  </div>
	{{ end }}
      {{ else }}
        <a href="{{ .URL | relLangURL }}"><button class="pseudo_button">{{- $menuName -}}</button></a>
      {{ end }}
    {{ end }}
  </ul>
</body>
