{% extends 'layouts/barebone.njk' %}

{% set title = error_code + ' - ' + error_message %}

{% block _stylesheets %}
    <link rel="stylesheet" href="/css/error.css">
{% endblock %}

{% block _body %}
    <div class="logo"><a href="/">{{ app.name }}</a></div>

    <main class="{% block class %}{% endblock %}">
        {% if flash %}
            {{ macros.messages(flash) }}
        {% endif %}

        <div class="error-code">{{ error_code }}</div>
        <div class="error-message">{{ error_message }}</div>
        <div class="error-instructions">{{ error_instructions|safe }}</div>

        <nav>
            {% set previousURL = getPreviousURL() %}
            {% if previousURL and previousURL != '/' and previousURL != url %}
                <a href="{{ previousURL }}" class="button"><i data-feather="arrow-left"></i> Go back</a>
            {% endif %}

            <a href="/" class="button"><i data-feather="home"></i> Go to homepage</a>
        </nav>
    </main>

    <div class="contact">
        Error ID: {{ error_id }}
        <br>
        If you think this isn't right, please contact us with the above error ID at
        <a href="mailto:{{ app.contact_email }}">{{ app.contact_email }}</a>.
    </div>
{% endblock %}