{% load i18n static misago_absoluteurl misago_json %}
<!DOCTYPE html>
<html lang="{{ LANGUAGE_CODE_SHORT }}">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <title>{% spaceless %}{% block title %}{{ settings.forum_name }}{% endblock %}{% endspaceless %}</title>
    <meta name="description" content="{% spaceless %}{% block meta-description %}{% endblock %}{% endspaceless %}">
    {% spaceless %}
      {% block meta-extra %}{% endblock meta-extra %}
      {% block og-tags %}
        <meta property="og:site_name" content="{% spaceless %}{% block og-site-name %}{{ settings.forum_name }}{% endblock og-site-name %}{% endspaceless %}" />
        <meta name="twitter:card" content="summary" />
        <meta property="og:title" content="{% spaceless %}{% block og-title %}{% endblock og-title %}{% endspaceless %}" />
        <meta name="twitter:title" content="{% spaceless %}{% block twitter-title %}{% endblock twitter-title %}{% endspaceless %}" />
        <meta property="og:description" content="{% spaceless %}{% block og-description %}{{ settings.forum_index_meta_description|default:'' }}{% endblock og-description %}{% endspaceless %}" />
        <meta name="twitter:description" content="{% spaceless %}{% block twitter-description %}{{ settings.forum_index_meta_description|default:'' }}{% endblock twitter-description %}{% endspaceless %}" />
        <meta property="og:type" content="website" />
        <meta property="og:url" content="{% spaceless %}{% block og-url %}{{ settings.forum_address }}{% endblock og-url %}{% endspaceless %}" />
        <meta name="twitter:url" content="{% spaceless %}{% block twitter-url %}{{ settings.forum_address }}{% endblock twitter-url %}{% endspaceless %}" />
        {% block og-image %}
          {% if og_image %}
            <meta name="twitter:image" content="{% absoluteurl og_image.url %}" />
            <meta property="og:image" content="{% absoluteurl og_image.url %}" />
            <meta property="og:image:width" content="{{ og_image.width }}" />
            <meta property="og:image:height" content="{{ og_image.height }}" />
          {% else %}
            {% static "misago/img/og-image.jpg" as og_image_url %}
            <meta name="twitter:image" content="{% absoluteurl og_image_url %}" />
            <meta property="og:image" content="{% absoluteurl og_image_url %}" />
            <meta property="og:image:width" content="1200" />
            <meta property="og:image:height" content="630" />
          {% endif %}
        {% endblock og-image %}
      {% endblock og-tags %}
      {% if theme.include_defaults %}
        <link href="{% static 'misago/css/misago.css' %}" rel="stylesheet">
      {% endif %}
      {% for css_url in theme.styles %}
        <link href="{{ css_url }}" rel="stylesheet">
      {% endfor %}
      {% if icons.apple_touch_icon %}
        <link rel="apple-touch-icon" sizes="180x180" href="{{ icons.apple_touch_icon }}" />
      {% else %}
        <link rel="apple-touch-icon" sizes="180x180" href="{% static 'misago/apple-touch-icon.png' %}" />
      {% endif %}
      {% if icons.favicon_32 %}
        <link rel="icon" type="image/png" sizes="32x32" href="{{ icons.favicon_32 }}" />
      {% else %}
        <link rel="icon" type="image/png" sizes="32x32" href="{% static 'misago/favicon-32.png' %}" />
      {% endif %}
      {% if icons.favicon_16 %}
        <link rel="icon" type="image/png" sizes="16x16" href="{{ icons.favicon_16 }}" />
      {% else %}
        <link rel="icon" type="image/png" sizes="16x16" href="{% static 'misago/favicon-16.png' %}" />
      {% endif %}
      {% if icons.favicon %}
        <link rel="shortcut icon" href="{{ icons.favicon }}" />
      {% else %}
        <link rel="shortcut icon" href="{% static 'misago/favicon.ico' %}" />
      {% endif %}
    {% endspaceless %}
    <script type="application/ld+json">{"@context":"http://schema.org","@type":"WebSite","url":"{{ settings.forum_address }}"}</script>
  </head>
  <body class="misago-{% if user.is_authenticated %}authenticated{% else %}anonymous{% endif %}{% if misago_agreement %} agreement-overlay-visible{% endif %}">
    {% if settings.google_tracking_id %}
      {% include "misago/analytics.html" %}
    {% endif %}

    <div id="auth-message-mount"></div>
    <div id="snackbar-mount"></div>

    <div id="misago-container" {% if misago_agreement %}aria-hidden="true"{% endif %}>
      {% include "misago/jumbotron.html" %}
      {% include "misago/navbar.html" %}

      <div id="page-mount">
        {% block content %}{% endblock content %}
      </div>

      {% include "misago/footer.html" %}
    </div>
    {% include "misago/auth.html" %}

    <div id="posting-mount"></div>
    <div id="posting-spacer"></div>
    <div class="modal fade" id="modal-mount" tabindex="-1" role="dialog" aria-labelledby="misago-modal-label"></div>

    {% if misago_agreement %}
      {% include "misago/required_agreement.html" %}
    {% endif %}

    <script src="{% url 'django-i18n' %}?{{ LANGUAGE_CODE }}"></script>
    <script src="{% static 'misago/js/vendor.js' %}"></script>
    <script src="{% static 'misago/js/misago.js' %}"></script>
    {% include "misago/scripts.html" %}
    <script type="text/javascript">
      misago.init({{ frontend_context|as_json }});
    </script>

  </body>
</html>
