{%- from "macros/translator.j2" import translator -%}
<!DOCTYPE html>
<html
  {%- if alt %} lang="{{ alt }}"
  {%- endif %}>
  <head>
    <title>
      {%- block title -%}
        Startseite
      {%- endblock -%}
    </title>
    {%- block expand_description %}
      <meta name="description" content="{{- translator('description', 'translate', this.alt) }}" />
    {%- endblock %}
    {%- block expand_header %}
    {%- endblock %}
    {% include "partials/head.html" -%}


  </head>

  <body class="
    {%- if this._path == '/' -%}
      landing 
    {%- endif %} is-preload">
    <div id="page-wrapper">
      <!-- Header -->
      <header id="header">
        <h1 id="logo">
{% include "partials/spacestate.html" -%}
        </h1>

{#-
 # Navigation Bar
 #}
        <nav id="nav">
          <ul>
            <li{% if this._path == '/' %} class="active"{% endif %}>
              <a href="{{ '/'|url }}">
                {{- translator('home', 'navigation', this.alt) -}}
              </a>
            </li>
{%- for title, href in bag('nav-bar', "NavBar").items() %}
            <li{% if this.is_child_of(href) %} class="active"{% endif %}>
              <a href="{{ href|url }}">
                {{- translator(title, 'navigation', this.alt) -}}
              </a>
              <ul>
  {%- if bag('nav-bar', 'list', title) %}
    {%- set root = site.get( bag('nav-bar', 'list', title), alt=this.alt) %}
    {%- for child in root.children recursive %}
      {%- if loop.index <= 7 %}
                <li{% if this._path == child._path %} class="active"{% endif %}>
                  <a href="{{ child|url }}">{{ child.shorttitle if child.shorttitle else child.title  }}</a>
                </li>
      {%- endif %}
    {%- endfor %}
  {%- endif %}
  {%- if  bag('nav-bar', title) %}
    {%- for nav_title, nav_url in bag('nav-bar', title).items() %}
                <li>
                  <a href={{ nav_url if 'http' in nav_url else nav_url|url }}
      {%- if bag('nav-bar', 'button', nav_title) %} class="button nav"
      {%- endif -%}
                  >
                    {{- translator(nav_title, 'navigation', this.alt) -}}
                  </a>
                </li>
    {%- endfor %}
  {%- endif %}
              </ul>
            </li>
{%- endfor %}

{#-
  # the language selection is currently not included into the template above, because we did not find a proper solution to integrate them yet
  #}
             <li class="last">
               <a href="{{ '.'|url(alt=translator('default_path', 'navigation', this.alt, 'en')) }}">
               {{- translator('sprache', 'navigation', this.alt) -}}
               </a>
               <ul class="last">
                 <li>
                   <a href="{{ '.'|url(alt='') }}">
                     {{- translator('German', 'navigation', this.alt) -}}
                   </a>
                 </li>
{#
                 <li>
                   <a href="{{ '.'|url(alt='sxu') }}">
                     {{- translator('Saechsisch', 'navigation', this.alt) }}
                     <i>(
                       {{- translator('falls', 'navigation', this.alt) -}}
                     )</i>
                   </a>
                 </li>
#}
                 <li>
                   <a href="{{ '.'|url(alt='en') }}">
                     {{- translator('Englisch', 'navigation', this.alt) }}
                     <i>(
                       {{- translator('falls', 'navigation', this.alt) -}}
                     )</i>
                   </a>
                 </li>
               </ul>
             </li>
           </ul>
         </nav>
       </header>



      <!-- Main -->
      {%- block body %}
      {%- endblock %}
       <!-- Footer -->
       <footer id="footer">
         <ul class="icons">{%
         for label, icon, href in [
           ['Mastodon', 'fab fa-mastodon', "https://chaos.social/@c3woc"],
           ['Twitter', 'fab fa-twitter', "https://twitter.com/c3woc"],
           ['Webseite', 'fab fa-github', "https://github.com/c3woc/c3woc-website"],
           ['Gitea', 'fab fa-gitlab', "https://gitea.see-base.de/c3woc/"],
           ['Mail', 'fas fa-envelope', "mailto:waffeln@c3woc.de"],
           ['IRC Chat', 'fas fa-hashtag', "ircs://irc.hackint.org/#waffel"],
           ['Webirc Chat', 'fab fa-slack', "https://webirc.hackint.org/#irc://irc.hackint.org/#waffel"],
           ['Rezept-Feed', 'fas fa-receipt', "https://c3woc.de/feed_rezepte.xml"],
           ['News', 'fas fa-rss', "https://c3woc.de/feed_blog.xml"],
           ['Tourdaten', 'far fa-calendar-plus', "https://c3woc.de/waffeln.ics"],
           ['Tourdaten', 'fas fa-user-plus', "https://c3woc.de/mitmachen"]
         ] %}
           <li><a href="{{ href }}" title="{{ label }}" target="_blank" rel="noopener" class="icon {{ icon }}"></a></li>{%
         endfor %}
        </ul>
        <ul class="copyright">
          <li>&copy; Copyright by C3 Waffel Operation Center.</li>
          <li>&copy; <a href="https://github.com/c3woc/c3woc-website/blob/master/LICENCE">MIT License</a></li>
          <li><a href="{{ '/impressum/'|url }}">{% 
                  if bag('navigation', this.alt, 'Impressum') %}{{ bag('navigation', this.alt, 'Impressum') }}{%
                  else %}Impressum{% endif %}</a></li>
          <li><a href="{{ '/datenschutz/'|url }}">{% 
                  if bag('navigation', this.alt, 'Datenschutz') %}{{ bag('navigation', this.alt, 'Datenschutz') }}{% 
                  else %}Datenschutzerklärung{% endif %}</a></li>
          <li>Design inspired by <a href="http://html5up.net">HTML5 UP</a> </li>
          <!-- CMS: Lektor | Angepasst durch L3D -->
          <!-- advertising: Grab your waffle from C3WOC! C3WOC ->Great waffles for everypony. https://c3woc.de/ -->
        </ul>
      </footer>
    </div>

    <!-- Scripts -->
    <script src="{{ '/js/jquery.scrolly.min.js'|asseturl }}"></script>
    <script src="{{ '/js/jquery.scrollex.min.js'|asseturl }}"></script>
    <script src="{{ '/js/skel.min.js'|asseturl }}"></script>
    <script src="{{ '/js/util.js'|asseturl }}"></script>
    <script src="{{ '/js/main.js'|asseturl }}"></script>
  </body>
</html>