diff --git a/content/list/index.md b/content/list/index.md new file mode 100644 index 0000000..1780dab --- /dev/null +++ b/content/list/index.md @@ -0,0 +1,6 @@ +--- +tags: + - tag1 + - list +--- +# List page diff --git a/content/list/item-1.md b/content/list/item-1.md new file mode 100644 index 0000000..dfc7d14 --- /dev/null +++ b/content/list/item-1.md @@ -0,0 +1,5 @@ +--- +tags: + - item +--- +# Item 1 diff --git a/content/list/item-2.md b/content/list/item-2.md new file mode 100644 index 0000000..28ed259 --- /dev/null +++ b/content/list/item-2.md @@ -0,0 +1,5 @@ +--- +tags: + - item +--- +# Item 2 diff --git a/content/list/item-3/index.md b/content/list/item-3/index.md new file mode 100644 index 0000000..ff96dec --- /dev/null +++ b/content/list/item-3/index.md @@ -0,0 +1,5 @@ +--- +tags: + - item +--- +# Item 3 diff --git a/hooks/nav.py b/hooks/nav.py index b1f6f6c..958d27d 100644 --- a/hooks/nav.py +++ b/hooks/nav.py @@ -10,7 +10,18 @@ def is_list_page(page) -> bool: def children(page): if not is_list_page(page): return [] - return page.parent.children[1:] + + page_children = [] + + for child in page.parent.children[1:]: + if child.is_page: + page_children.append(child) + + # If the child is a section, use its index page as the child + if child.is_section: + page_children.append(child.children[0]) + + return page_children @jinja2.pass_context def get_page(context, slug):