Module

core.page.navigation

Page Navigation Mixin - Navigation and hierarchy relationships.

Classes

PageNavigationMixin
Mixin providing navigation capabilities for pages. This mixin handles: - Site-level navigation: ne…
6

Mixin providing navigation capabilities for pages.

This mixin handles:

  • Site-level navigation: next, prev
  • Section-level navigation: next_in_section, prev_in_section
  • Hierarchy: parent, ancestors

Attributes

Name Type Description
_site Any
_section Section | None
_section_path Path | None

Methods 6

next property
Get the next page in the site's collection of pages.
Page | None
def next(self) -> Page | None

Get the next page in the site's collection of pages.

Returns

Page | None

Next page or None if this is the last page

prev property
Get the previous page in the site's collection of pages.
Page | None
def prev(self) -> Page | None

Get the previous page in the site's collection of pages.

Returns

Page | None

Previous page or None if this is the first page

next_in_section property
Get the next page within the same section, respecting weight order. Pages are …
Page | None
def next_in_section(self) -> Page | None

Get the next page within the same section, respecting weight order.

Pages are ordered by weight (ascending), then alphabetically by title. Pages without weight are treated as weight=999999 (appear at end). Index pages (_index.md, index.md) are skipped in navigation.

Returns

Page | None

Next page in section or None if this is the last page

prev_in_section property
Get the previous page within the same section, respecting weight order. Pages …
Page | None
def prev_in_section(self) -> Page | None

Get the previous page within the same section, respecting weight order.

Pages are ordered by weight (ascending), then alphabetically by title. Pages without weight are treated as weight=999999 (appear at end). Index pages (_index.md, index.md) are skipped in navigation.

Returns

Page | None

Previous page in section or None if this is the first page

parent property
Get the parent section of this page.
Any | None
def parent(self) -> Any | None

Get the parent section of this page.

Returns

Any | None

Parent section or None

ancestors property
Get all ancestor sections of this page.
list[Any]
def ancestors(self) -> list[Any]

Get all ancestor sections of this page.

Returns

list[Any]

List of ancestor sections from immediate parent to root