diff --git a/hooks/nav.py b/hooks/nav.py index 7d9f723..fbca9be 100644 --- a/hooks/nav.py +++ b/hooks/nav.py @@ -4,5 +4,11 @@ def is_list_page(page) -> bool: return page.parent.children[0] == page +def children(page): + if not is_list_page(page): + return [] + return page.parent.children[1:] + def on_env(env, config, files): env.filters["is_list_page"] = is_list_page + env.filters["children"] = children diff --git a/theme/main.html b/theme/main.html index 7ea4026..5c3f169 100644 --- a/theme/main.html +++ b/theme/main.html @@ -7,4 +7,4 @@ Section: {{ page.is_section }} Is lits page: {{ page|is_list_page }} -Children: {{ page.children }} +Children: {{ page|children }}