<!DOCTYPE html>
<html lang="{{ DEFAULT_LANG }}">
    <head>
    {% block head %}
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <meta name="description" content="{% block description %}{% endblock description %}">
        <meta name="keywords" content="{% block keywords %}{% endblock keywords %}">
        <link rel="icon" href="{{ SITEURL }}/favicon.ico">

        <title>{% block title %}{{ SITENAME }}{% endblock title %}</title>

        <!-- Stylesheets -->
        {% if NEST_CSS_MINIFY %}
        <link href="{{ SITEURL }}/theme/css/all.min.css" rel="stylesheet">
        {% else %}
        <link href="{{ SITEURL }}/theme/css/bootstrap.min.css" rel="stylesheet">
        <link href="{{ SITEURL }}/theme/css/fonts.css" rel="stylesheet">
        <link href="{{ SITEURL }}/theme/css/nest.css" rel="stylesheet">
        <link href="{{ SITEURL }}/theme/css/pygment.css" rel="stylesheet">
        {% endif %}
        <!-- /Stylesheets -->

        <!-- RSS Feeds -->
        {% if FEED_ALL_ATOM %}
        <link href="{{ FEED_DOMAIN }}/{{ FEED_ALL_ATOM }}" type="application/atom+xml" rel="alternate" title="{{ SITENAME }} Full Atom Feed" />
        {% endif %}
        {% if FEED_ALL_RSS %}
        <link href="{{ FEED_DOMAIN }}/{{ FEED_ALL_RSS }}" type="application/rss+xml" rel="alternate" title="{{ SITENAME }} Full RSS Feed" />
        {% endif %}
        {% if FEED_ATOM %}
        <link href="{{ FEED_DOMAIN }}/{{ FEED_ATOM }}" type="application/atom+xml" rel="alternate" title="{{ SITENAME }} Atom Feed" />
        {% endif %}
        {% if FEED_RSS %}
        <link href="{{ FEED_DOMAIN }}/{{ FEED_RSS }}" type="application/rss+xml" rel="alternate" title="{{ SITENAME }} RSS Feed" />
        {% endif %}
        {% if CATEGORY_FEED_ATOM and category %}
        <link href="{{ FEED_DOMAIN }}/{{ CATEGORY_FEED_ATOM|format(category.slug) }}" type="application/atom+xml" rel="alternate" title="{{ SITENAME }} Categories Atom Feed" />
        {% endif %}
        {% if CATEGORY_FEED_RSS and category %}
        <link href="{{ FEED_DOMAIN }}/{{ CATEGORY_FEED_RSS|format(category.slug) }}" type="application/rss+xml" rel="alternate" title="{{ SITENAME }} Categories RSS Feed" />
        {% endif %}
        {% if TAG_FEED_ATOM and tag %}
        <link href="{{ FEED_DOMAIN }}/{{ TAG_FEED_ATOM|format(tag.slug) }}" type="application/atom+xml" rel="alternate" title="{{ SITENAME }} Tags Atom Feed" />
        {% endif %}
        {% if TAG_FEED_RSS and tag %}
        <link href="{{ FEED_DOMAIN }}/{{ TAG_FEED_RSS|format(tag.slug) }}" type="application/rss+xml" rel="alternate" title="{{ SITENAME }} Tags RSS Feed" />
        {% endif %}
        <!-- /RSS Feeds -->

        <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
        <!--[if lt IE 9]>
          <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
          <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
        <![endif]-->

        {% if GOOGLE_ANALYTICS %}
        <!-- Google Analytics -->
        <script>
          (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
          (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
          m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
          })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

          ga('create', '{{ GOOGLE_ANALYTICS }}', 'auto');
          ga('send', 'pageview');
        </script>
        <!-- /Google Analytics -->
        {% endif %}

        {% if PIWIK_URL and PIWIK_SITE_ID %}
        <!-- Piwik Analytics -->
        <script type="text/javascript">
          var _paq = _paq || [];
          _paq.push(['trackPageView']);
          _paq.push(['enableLinkTracking']);
          (function() {
            {% if PIWIK_SSL_URL %}
            var u="{{ PIWIK_SSL_URL }}/";
            {% else %}
            var u="{{ PIWIK_URL }}/";
            {% endif %}
            _paq.push(['setTrackerUrl', u+'piwik.php']);
            _paq.push(['setSiteId', {{ PIWIK_SITE_ID }}]);
            var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
            g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'piwik.js'; s.parentNode.insertBefore(g,s);
          })();
        </script>
        {% if PIWIK_SSL_URL %}
          <noscript><p><img src="{{ PIWIK_SSL_URL }}//piwik.php?idsite={{ PIWIK_SITE_ID }}" style="border:0;" alt="" /></p></noscript>
        {% else %}
          <noscript><p><img src="{{ PIWIK_URL }}/piwik.php?idsite={{ PIWIK_SITE_ID }}" style="border:0;" alt="" /></p></noscript>
        {% endif %}
        <!-- /Piwik Analytics -->
        {% endif %}

    {% endblock head %}
    </head>

    <body {% if PAGE_BACKGROUND %}  style="background-image: url('{{ PAGE_BACKGROUND }}');" {% endif %} >

        <!-- Header -->
        {% block headerstyle %}
        {% endblock headerstyle %}

            <!-- Static navbar -->
            <div class="container">
                <div class="header-nav">
                    <div class="header-logo">
                        <a class="pull-left" href="{{ SITEURL }}/"><img class="mr20" src="{{ SITEURL }}{{ NEST_HEADER_LOGO or "/logo.svg" }}" alt="logo">{{ SITENAME }}</a>
                    </div>
                    <div class="nav pull-right">
                        {% for title, link in MENUITEMS %}
                            {% if 'http://' in link or 'https://' in link %}
                                <a href="{{ link }}">{{ title }}</a>
                            {% else %}
                                <a href="{{ SITEURL }}{{ link }}">{{ title }}</a>
                            {% endif %}
                        {% endfor %}
                        {% if DISPLAY_PAGES_ON_MENU %}
                        {% for pg in PAGES %}
                            <a {% if pg == page %} class="active"{% endif %} href="{{ SITEURL }}/{{ pg.url }}">{{ pg.title }}</a>
                        {% endfor %}
                        {% endif %}
                    </div>
                </div>
            </div>
            <!-- /Static navbar -->

            <!-- Header -->
            {% block header %}
            {% endblock header %}
            <!-- /Header -->

        </div>
        <!-- /Header -->


        <!-- Content -->
        {% block content %}
        {% endblock %}
        <!-- /Content --> 

        <!-- Footer -->
        <div class="footer gradient-2">
            <div class="container footer-container ">
                <div class="row">
                    <div class="col-xs-4 col-sm-3 col-md-3 col-lg-3">
                        <div class="footer-title">{{ NEST_SITEMAP_COLUMN_TITLE }}</div>
                        <ul class="list-unstyled">
                            {% for title, link in NEST_SITEMAP_MENU %}
                            <li><a href="{{ SITEURL }}{{ link }}">{{ title }}</a></li>
                            {% endfor %}
                            {% if FEED_ALL_ATOM %}
                            <li><a href="{{ FEED_DOMAIN }}/{{ FEED_ALL_ATOM }}" type="application/atom+xml" rel="alternate">{{ NEST_SITEMAP_ATOM_LINK }}</a></li>
                            {% endif %}
                            {% if FEED_ALL_RSS %}
                            <li><a href="{{ FEED_DOMAIN }}/{{ FEED_ALL_RSS }}" type="application/rss+xml" rel="alternate">{{ NEST_SITEMAP_RSS_LINK }}</a></li>
                            {% endif %}
                        </ul>
                    </div>
                    <div class="col-xs-4 col-sm-3 col-md-3 col-lg-3">
                        {% if SOCIAL %}
                        <div class="footer-title">{{ NEST_SOCIAL_COLUMN_TITLE }}</div>
                        <ul class="list-unstyled">
                            {% for name, link in SOCIAL %}
                            <li><a href="{{ link }}" target="_blank">{{name}}</a></li>
                            {% endfor %}
                        </ul>
                        {% endif %}
                    </div>
                    <div class="col-xs-4 col-sm-3 col-md-3 col-lg-3">
                        {% if LINKS %}
                        <div class="footer-title">{{ NEST_LINKS_COLUMN_TITLE }}</div>
                        <ul class="list-unstyled">
                            {% for name, link in LINKS %}
                            <li><a href="{{ link }}" target="_blank">{{name}}</a></li>
                            {% endfor %}
                        </ul>
                        {% endif %}
                    </div> 
                    <div class="col-xs-12 col-sm-3 col-md-3 col-lg-3">
                        <p class="pull-right text-right">
                            <small><em>Proudly powered by <a href="http://docs.getpelican.com/" target="_blank">pelican</a></em></small><br/>
                            <small><em>Theme and code by <a href="https://github.com/molivier" target="_blank">molivier</a></em></small><br/>
                            <small>{{ NEST_COPYRIGHT }}</small>
                            <small><em><a
                            rel="license"
                            href="http://creativecommons.org/licenses/by-nc/4.0/"><img
                            alt="Licenza Creative Commons"
                            style="border-width:0"
                            src="https://i.creativecommons.org/l/by-nc/4.0/88x31.png"
                            /></a></em></small>
                        </p>
                    </div>
                </div>
            </div>
        </div>
        <!-- /Footer -->
    </body>
</html>
