{% extends "basic-ng/components/view-this-page.html" %}
{% from "basic-ng/components/view-this-page.html" import determine_page_view_link with context %}

{%- macro furo_view_button(url) -%}
<div class="view-this-page">
  <a class="muted-link" href="{{ url }}" title="{{ _("View this page") }}">
    <svg><use href="#svg-eye"></use></svg>
    <span class="visually-hidden">{{ _("View this page") }}</span>
  </a>
</div>
{%- endmacro -%}

{% block link_available -%}
{{ furo_view_button(determine_page_view_link()) }}
{%- endblock %}

{% block link_not_available %}
{# Make nice things happen, on Read the Docs #}
{%- if READTHEDOCS and conf_py_path and page_source_suffix and github_user != "None" and github_repo != "None" and github_version and pagename and page_source_suffix %}
  {% set url = "https://github.com/" + github_user + "/" + github_repo + "/blob/" + github_version + conf_py_path + pagename + page_source_suffix + "?plain=true" %}
  {{ furo_view_button(url) }}
{%- endif -%}
{% endblock %}
