{% load static %}
{% include "se/components/modal.html" with id="tags" title=tags_edit_title %}

{% block head %}
    <script src="{% static 'se/tags.js' %}"></script>

    {# Token used by Javscript code to make ``fetch`` requests #}
    <meta name="csrf-token" content="{{ csrf_token }}">
{% endblock %}

<div id="top_bar_links">
    {% if doc.has_thumbnail %}
        <img src="{{ settings.SOSSE_THUMBNAILS_URL }}{{ doc.image_name }}.jpg" class="archive-preview" />
    {% endif %}
    <p style="color: #081; font-size: 13px">
        {{ beautified_url }}
    </p>
    <p>
        {% include "se/components/tags_list.html" with id="document_tags" %}
    </p>

    <ul class="archive_links" style="margin-bottom: 20px">
      {% if 'se.view_document' in perms %}
        <li>🛠️<a href="{% url 'admin:se_document_change' doc.id %}">Administration</a></li>
      {% endif %}
      <li>🔗<a href="{% url 'search_redirect' %}?ft1=inc&ff1=lto_url&fo1=equal&fv1={{ doc.url|urlencode }}">Links to here</a></li>
      <li>🔗<a href="{% url 'search_redirect' %}?ft1=inc&ff1=lby_url&fo1=equal&fv1={{ doc.url|urlencode }}">Links from here</a></li>
      <li>{{ doc.get_source_link }}</li>
    </ul>
    <div class="archive_links" style="margin-bottom: 10px">
      {% if other_links %}
        {% for link in other_links %}
          {% if view_name != link.name %}
            <a class="tab_link" href="{{ link.href }}">{{ link.text_icon }} {{ link.text }}</a>
          {% else %}
            <a class="tab_link" id="tab_selected">
              {{ link.text_icon }} {{ link.text }}
            </a>
          {% endif %}
        {% endfor %}
      {% endif %}
    </div>
    {% if doc.redirect_url %}
        <br/>
        This page redirects to <a href="{{ www_redirect_url }}">{{ doc.redirect_url }}</a> · <a href="{{ doc.redirect_url }}">🌍</a>
    {% endif %}
    {% if doc.too_many_redirects %}
        <br/>
        Redirection was not followed, because the crawler was redirected too many times
    {% endif %}
</div>
