{% extends "layout.html" %}

{% load staticfiles %}

{% block extrahead %}
<!-- Google pagespeed -->
{% if cookie_jar.settings.google_tag_manager and cookie_jar.functional.is_allowed%}
<link rel="preconnect" href="https://www.googletagmanager.com"/>
{% endif %}
{% if cookie_jar.settings.google_analytics and cookie_jar.functional.is_allowed %}
<link rel="preconnect" href="https://www.google-analytics.com/">
{% endif %}

{{ block.super }}

{# only include cookie approval assets if approval is required #}
{% if cookie_jar.needs_approval %}
    <link rel="stylesheet" type="text/css" href="{% static 'cookie_jar/css/cookie_jar.css' %}" />
{% endif %}

{# always render all the active plugin templates #}
{% for header_snippet in cookie_jar.activated_snippet_header_templates %}
    {% include header_snippet %}
{% endfor %}
{% endblock %}

{% block extrascripts %}
{{ block.super }}
{# only include cookie approval assets if approval is required #}
{% if cookie_jar.needs_approval %}
    <script src="{% static 'cookie_jar/js/cookie_jar.js' %}"></script>
{% endif %}
{% endblock %}

{% block cdn_scripts %}
{{ block.super }}
{% block cookiejar_ecommerce %}{% endblock %}
{% block cookiejar %}
    {% for footer_snippet in cookie_jar.activated_snippet_footer_templates %}
        {% include footer_snippet %}
    {% endfor %}
    {% include 'cookie_jar/cookie_banner.html' %}
{% endblock %}
{% endblock %}