<!doctype html>
<!--[if lt IE 7]>      <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]>         <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]>         <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]-->
  <head>
    {% block meta %}
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width" />
        <meta property="og:site_name" content="{{ page.og_title }}" />
    {% endblock %}

    <title>{% block title %}{{ page.name }}{% endblock %}</title>

    {% block styles %}
      {% if app.debug %}
        <link rel="stylesheet" href="{{ asset('.tmp/dev/styles/main.css') }}" />
      {% else %}
        <link rel="stylesheet" href="{{ asset('dist/styles/main.css') }}" />
      {% endif %}
    {% endblock %}
    {% if app.debug %}
        <script type="text/javascript" src="//localhost:35729/livereload.js"></script>
        <script type="text/javascript" src="{{ asset('dev/bower_components/modernizr/modernizr.js') }}"></script>
    {%  else  %}
        <script type="text/javascript" src="{{ asset('dist/bower_components/modernizr/modernizr.js') }}"></script>
    {% endif %}
  </head>
  <body>
    {% block header %}{% endblock %}
    {% block content %}{% endblock %}
    {% block footer %}{% endblock %}
    {% block scripts %}
        <script type="text/javascript">if(!window.SI) { window.SI = {};}</script>
        {# Get a JSON wad of all conversion pixels #}
        {% if page is defined and page.conversion_pixels is defined %}
        <script type="text/javascript">
            SI.conversionPixels = {
            {% for pixelKey, pixelValues in page.conversion_pixels %}
            {{ pixelKey }}: {
                name: '{{ pixelValues.0.name }}',
                        slug: '{{ pixelValues.0.slug }}',
                        object_ids: {{ pixelValues|values_for('object_id')|json_encode|raw }}
                {% if loop.last %}
            }
            {% else %}
            },
            {% endif %}
            {%  endfor  %}
            };
        </script>
        {% endif %}

        {# 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 ID #}
            ga('create', '{{ page.ga_id }}');
            {# GA Campaign #}
            {% if page is defined %}
            ga('set', {{ page.ga_campaign|json_encode|raw }});
            {% endif %}
            {# GA Page load events #}
            ga('send', 'pageview');
        </script>
        {# Application scripts #}
        {% if app.debug %}
            <script type="text/javascript">window.SI.debug = true;</script>
            <script data-main="{{ asset('dev/scripts/main.js') }}" src="{{ asset('dev/bower_components/requirejs/require.js') }}"></script>
        {% else %}
            <script src="{{ asset('dist/scripts/main.js') }}"></script>
        {% endif %}
    {% endblock %}
  </body>
</html>