diff --git a/content/nested/sibling.md b/content/nested/sibling.md new file mode 100644 index 0000000..9933f1a --- /dev/null +++ b/content/nested/sibling.md @@ -0,0 +1 @@ +# Sibling diff --git a/hooks/nav.py b/hooks/nav.py new file mode 100644 index 0000000..7d9f723 --- /dev/null +++ b/hooks/nav.py @@ -0,0 +1,8 @@ +def is_list_page(page) -> bool: + if not page.parent: + return False + + return page.parent.children[0] == page + +def on_env(env, config, files): + env.filters["is_list_page"] = is_list_page diff --git a/mkdocs.yml b/mkdocs.yml index 6a3cde4..dda4cf7 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -5,3 +5,6 @@ strict: true theme: name: null custom_dir: theme + +hooks: + - hooks/nav.py diff --git a/theme/main.html b/theme/main.html index e6b9185..7ea4026 100644 --- a/theme/main.html +++ b/theme/main.html @@ -1,3 +1,10 @@ {{ page.content }} -{{ nav }} +Nav: {{ nav }} + +Parent: {{ page.parent }} +Section: {{ page.is_section }} + +Is lits page: {{ page|is_list_page }} + +Children: {{ page.children }}