From 41307e805074654e870b7555fb0525b300da10d2 Mon Sep 17 00:00:00 2001 From: ES-Alexander Date: Mon, 2 Dec 2024 00:42:32 +1100 Subject: [PATCH] templates: page: support external redirects Some of the docs have moved, so let's send visitors to the new ones (and hide the outdated content). --- templates/docs/page.html | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/templates/docs/page.html b/templates/docs/page.html index 9fed944..c17fca0 100644 --- a/templates/docs/page.html +++ b/templates/docs/page.html @@ -8,6 +8,7 @@ {# This value is matched by the config.extra.menu.main~url #} {% set current_section = page.path | split(pat="/") | slice(end=-2) | join(sep="/") %} {{ macros_header::header(current_section=current_section)}} + {% if page.extra.external_redirect %}{% endif %} {% endblock header %} {% block content %} @@ -15,15 +16,20 @@
{{ macros_sidebar::docs_sidebar(current_section=current_section) }} - {{ macros_toc::docs_toc(page=page) }} + {% if not page.extra.external_redirect %}{{ macros_toc::docs_toc(page=page) }}{% endif %}

{{ page.title }}

- {% if page.extra.lead %}

{{ page.extra.lead | safe }}

{% endif %} - {{ page.content | safe }} - {% if config.extra.edit_page %} - {{ macros_edit_page::docs_edit_page(current_path=current_path) }} + {% if page.extra.external_redirect %} +

This documentation has been moved to {{ page.extra.external_redirect }}.

+

You should be automatically redirected.

+ {% else %} + {% if page.extra.lead %}

{{ page.extra.lead | safe }}

{% endif %} + {{ page.content | safe }} + {% if config.extra.edit_page %} + {{ macros_edit_page::docs_edit_page(current_path=current_path) }} + {% endif %} + {{ macros_navigation::docs_navigation(page=page, current_section=current_section) }} {% endif %} - {{ macros_navigation::docs_navigation(page=page, current_section=current_section) }}