1
Fork 0

Reliably get page children for list pages

This commit is contained in:
Jake Howard 2023-09-08 22:32:51 +01:00
parent f3bb6b0b3c
commit c8eb405165
Signed by: jake
GPG Key ID: 57AFB45680EDD477
2 changed files with 7 additions and 1 deletions

View File

@ -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

View File

@ -7,4 +7,4 @@ Section: {{ page.is_section }}
Is lits page: {{ page|is_list_page }}
Children: {{ page.children }}
Children: {{ page|children }}