
{% set pageTitle = page.title || config.subtitle || '' %}

{% if is_archive() %}
  {% set pageTitle = 'Archives' %}
{% endif %}

{% if is_tag() %}
  {% set pageTitle = 'Tag: ' + page.tag %}
{% endif %}

{% if is_category() %}
  {% set pageTitle = 'Category: ' + page.category %}
{% endif %}

{% if is_month() %}
  {% set pageTitle = pageTitle + ': ' + page.month + '/' + page.year %}
{% endif %}

{% if is_year() %}
  {% set pageTitle = pageTitle + ': ' + page.year %}
{% endif %}

{% if pageTitle == '' %}
  {% set pageTitle = config.title %}
{% endif %}

<!doctype html>
<html lang="{{ config.language }}">
<head>
  <meta charset="UTF-8">
  <title>{{ pageTitle }}</title>
  <meta name="viewport" content="width=device-width, initial-scale=1.0"/>

  {% if theme.stylesheets !== undefined && theme.stylesheets.length > 0 %}
    {# stylesheet list from _config.yml #}
    {% for url in theme.stylesheets %}
      <link rel="stylesheet" href="{{ url }}" media="print" onload="this.media='all'; this.onload=null;">
      <noscript><link rel="stylesheet" href="{{ url }}"></noscript>
    {% endfor %}
  {% endif %}
  <link rel="stylesheet" href="/materialize/css/materialize.css">

  {% block add_head %}{% endblock %}

</head>
<body>
<ul id="nav-mobile" class="sidenav">
          {% for key in Object.keys(theme.menu) %}
            <li><a href="{{ theme.menu[key] }}">{{ key }}</a></li>
          {% endfor %}
</ul>
  <nav class="light-blue lighten-1" role="navigation">
        <a href="#" data-target="nav-mobile" class="sidenav-trigger"><div class="mdi mdi-menu"></div></a>
      <div class="nav-wrapper">
        <ul class="right hide-on-med-and-down">
          {% for key in Object.keys(theme.menu) %}
            <li><a href="{{ theme.menu[key] }}">{{ key }}</a></li>
          {% endfor %}
        </ul>
      </div>
    </nav>

<main id="content" class="container xscontainer">
{% block body %}{% endblock %}
</main>


<footer class="page-footer light-blue darken-4">
  <div class="container">
    <div class="row">
      {% if theme.about_this_blog %}
        <div class="col s12 m4">
          <h5 class="white-text">About {{config.title}}</h5>
          <p>{{theme.about_this_blog}}</p>
        </div>
      {% endif %}
      {% if theme.footer_links %}
        <div class="col s6 m4">
          <h5 class="white-text"> Links </h5>
          <ul>
            {% for name in Object.keys(theme.footer_links) %}
            <li><a class="grey-text text-lighten-3" href="{{theme.footer_links[name]}}">{{name}}</a></li>
            {% endfor %}
            {% if theme.my_mastodon %}
            <li><a class="grey-text text-lighten-3" rel="me" href="{{theme.my_mastodon}}">My Mastodon</a></li>
            {% endif %}
          </ul>
        </div>
      {% endif %}
      {% if theme.theme_self_claim %}
        <div class="col s6 m4">
        <p>This blog uses Classical Material Design theme.</p>
        </div>
      {% endif %}
    </div>
  </div>
  <div class="footer-copyright">
    <div class="container truncate">
      © Copyright {{ theme.copyright_year_string }} {{ config.author }}. {{ theme.copyright_addtional }}
    </div>
  </div>
</footer>

{% if theme.scripts !== undefined && theme.scripts.length > 0 %}
  {# scripts list from config.yml #}
  {% for url in theme.scripts %}
    <script src="{{ url }}"></script>
  {% endfor %}
{% endif %}
{% block add_scripts %}{% endblock %}

</body>
</html>
