1
Fork 0

Ensure parent page is actually a page

This commit is contained in:
Jake Howard 2023-09-15 21:11:44 +01:00
parent 2b49b04154
commit b501c34afb
Signed by: jake
GPG key ID: 57AFB45680EDD477

View file

@ -25,11 +25,14 @@ def children(page):
def get_parent_page(page):
if is_list_page(page) and len(page.parent.children) == 1:
parent_section = page.parent.parent
if parent_section:
return parent_section.children[0]
parent = page.parent.parent
else:
parent = page.parent
return page.parent
if parent is None:
return None
return parent.children[0]
@jinja2.pass_context