Als Sonderlocke werden alle Toplevel-Seiten mit Kindern zu Kindern der Startseite gemacht. Daraus baue ich mir mein Menu.
# make toplevel index page to parent of toplevel pages with children
for page in _all_pages():
page_dir = get_path(page, page.settings)
if page_dir == '/' and page.slug == 'index':
for child_page in _all_pages():
if child_page != page and child_page.lang == page.lang:
childpage_dir = get_path(child_page, child_page.settings)
if childpage_dir == '/' and len(child_page.children) > 0:
child_page.parent = page
page.children.append(child_page)
Zum Abschluß wird für alle Seiten die komplette "Ahnenreihe" berechnet. Dies dient den Brotkrumen.
# set parents from parent
for page in _all_pages():
super_parent = page.parent
while super_parent:
page.parents.insert(0, super_parent)
super_parent = super_parent.parent