Skip to content

Commit

Permalink
templates: page: support external redirects
Browse files Browse the repository at this point in the history
Some of the docs have moved, so let's send visitors to the new ones (and hide the outdated content).
  • Loading branch information
ES-Alexander authored Dec 1, 2024
1 parent 4ff6228 commit 41307e8
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions templates/docs/page.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,28 @@
{# 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 %}<meta http-equiv="refresh" content="0; URL={{ page.extra.external_redirect }}" />{% endif %}
{% endblock header %}

{% block content %}
<div class="wrap container" role="document">
<div class="content">
<div class="row flex-xl-nowrap">
{{ 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 %}
<main class="docs-content col-lg-11 col-xl-9">
<h1>{{ page.title }}</h1>
{% if page.extra.lead %}<p class="lead">{{ page.extra.lead | safe }}</p>{% endif %}
{{ page.content | safe }}
{% if config.extra.edit_page %}
{{ macros_edit_page::docs_edit_page(current_path=current_path) }}
{% if page.extra.external_redirect %}
<p>This documentation has been moved to <a href="{{ page.extra.external_redirect }}">{{ page.extra.external_redirect }}</a>.</p>
<p>You should be automatically redirected.</p>
{% else %}
{% if page.extra.lead %}<p class="lead">{{ page.extra.lead | safe }}</p>{% 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) }}
</main>
</div>
</div>
Expand Down

0 comments on commit 41307e8

Please sign in to comment.