You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

56 lines
2.2 KiB
HTML

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

{% extends "index.html" %}
{% block title %}{{ page.title }} {{ config.title }}{% endblock title %}
{% block content %}
{{ page.content | safe }}
{% endblock content %}
{% block prev_link %}
{% if page.lower %}
<a class="previous" href="{{ page.lower.permalink }}">&lt;</a>
{% else %}
{# No page before, find the link for the section it's in if there is one #}
{% set parent = get_section(path=page.ancestors | reverse | first) %}
<a class="previous" href="{{ parent.permalink }}">&lt;</a>
{% endif %}
{% endblock prev_link %}
{% block next_link %}
{% if page.higher %}
<a class="next" href="{{ page.higher.permalink }}">&gt;</a>
{% else %}
{# No page after, find the link for the following section #}
{% set parent = get_section(path=page.ancestors | reverse | first) %}
{% set grand_parent = get_section(path=parent.ancestors | reverse | first) %}
{% set found_current = false %}
{% for s in grand_parent.subsections %}
{% set subsection = get_section(path=s) %}
{% if found_current %}
<a class="next" href="{{ subsection.permalink }}">&gt;</a>
{# no break #}
{% set_global found_current = false %}
{% endif %}
{% for p in subsection.pages %}
{% if p.permalink == page.permalink %}
{% set_global found_current = true %}
{% endif %}
{% endfor %}
{% endfor %}
{% if found_current %}
{% set all_sections = get_section(path="_index.md") %}
{% set_global found_next = false %}
{% for s in all_sections.subsections %}
{% set subsection = get_section(path=s) %}
{% if found_next %}
<a class="next" href="{{ subsection.permalink }}">&gt;</a>
{% break %}
{% endif %}
{% if subsection.permalink == grand_parent.permalink %}
{% set_global found_next = true %}
{% endif %}
{% endfor %}
{% endif %}
{% endif %}
{% endblock next_link %}