<h1>{{ page.data._verificationStatusIcon }} {{ page.title }}
    {% if page.title != page.data.path %}<br><small>({{ page.data.path }})</small>{%- endif -%}
</h1>

<ul>
    <li><a href="{{ site.github.repository_url }}/blob/{{ site.branch_name | default: "HEAD" }}/{{ site.basedir }}{{ page.data.path }}">View this file on GitHub</a></li>
    {% if page.data._document_path %}
    <li><a href="{{ site.github.repository_url }}/blob/{{ site.branch_name | default: "HEAD" }}/{{ site.basedir }}{{ page.data._document_path }}">View document part on GitHub</a></li>
    {%- endif -%}
    <li>Last update: {{ page.data.timestamp }}</li>
    {% if page.data.attributes.PROBLEM %}
    <li>Problem: <a href="{{ page.data.attributes.PROBLEM }}">{{ page.data.attributes.PROBLEM }}</a></li>
    {%- endif -%}
    {% if page.data._pathExtension == "hpp" %}<li><a id="include-directive-anchor">Include: <code id="include-directive-code">#include "{{ page.data.path }}"</code></a></li>{%- endif -%}
    {% if page.data._isVerificationFailed %}<li>Link: <a href="{{ site.github.repository_url }}/actions">{{ page.data._verificationStatusIcon }} View error logs on GitHub Actions</a></li>{%- endif -%}
    {% for link in page.data.attributes.links %}
    {% if link != page.data.attributes.PROBLEM %}
    <li>Link: <a href="{{ link }}">{{ link }}</a></li>
    {%- endif -%}
    {% endfor %}
</ul>

{% if page.data._pathExtension == "hpp" %}
<script defer type="text/javascript">
    // make the include directive clickable
    (function() {
        const anchor = document.getElementById('include-directive-anchor');
        const code = document.getElementById('include-directive-code');
        anchor.addEventListener('click', async function() {
            const textContent = code.textContent;
            navigator.clipboard.writeText(textContent)

            code.textContent = "Copied!";
            await new Promise(r => setTimeout(r, 300))
            code.textContent = textContent;
        });
    })();
</script>
{%- endif -%}
