templates/section.html: get the "next" link to work ...
... when the root section has only subsections below it, and no pages.
This commit is contained in:
Родитель
42c2fabf7f
Коммит
2353825676
|
@ -40,17 +40,23 @@
|
|||
{% else %}
|
||||
{# No page in the section, find the link for the following section #}
|
||||
{% set index = get_section(path="_index.md") %}
|
||||
{% set found_current = false %}
|
||||
{% for s in index.subsections %}
|
||||
{% set subsection = get_section(path=s) %}
|
||||
{% if found_current %}
|
||||
{{ macros::nav_next_item(rel_top=rel_top, title=subsection.title, path=subsection.path) }}
|
||||
{# no break #}
|
||||
{% set_global found_current = false %}
|
||||
{% endif %}
|
||||
{% if subsection.permalink == section.permalink %}
|
||||
{% set_global found_current = true %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% if current_path == "/" %}
|
||||
{# Is this the root section, and it has no pages? Start at the beginning. #}
|
||||
{% set subsection = get_section(path=index.subsections[0]) %}
|
||||
{{ macros::nav_next_item(rel_top=rel_top, title=subsection.title, path=subsection.path) }}
|
||||
{% else %}
|
||||
{% set found_current = false %}
|
||||
{% for s in index.subsections %}
|
||||
{% set subsection = get_section(path=s) %}
|
||||
{% if found_current %}
|
||||
{{ macros::nav_next_item(rel_top=rel_top, title=subsection.title, path=subsection.path) }}
|
||||
{# no break #}
|
||||
{% set_global found_current = false %}
|
||||
{% endif %}
|
||||
{% if subsection.permalink == section.permalink %}
|
||||
{% set_global found_current = true %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endblock next_link %}
|
||||
|
|
Загрузка…
Ссылка в новой задаче