Classes
PageCachesMixin
Mixin providing cached page list properties.
Requires these attributes on the host class:
- pa…
PageCachesMixin
Mixin providing cached page list properties.
Requires these attributes on the host class:
- pages: list[Page]
- _regular_pages_cache: list[Page] | None
- _generated_pages_cache: list[Page] | None
- _listable_pages_cache: list[Page] | None
- _page_path_map: dict[str, Page] | None
- _page_path_map_version: int
Attributes
| Name | Type | Description |
|---|---|---|
pages |
list[Page] |
|
_regular_pages_cache |
list[Page] | None |
|
_generated_pages_cache |
list[Page] | None |
|
_listable_pages_cache |
list[Page] | None |
|
_page_path_map |
dict[str, Page] | None |
|
_page_path_map_version |
int |
Methods 6
regular_pages
property
Get only regular content pages (excludes generated taxonomy/archive pages).
PE…
regular_pages
property def regular_pages(self) -> list[Page]
Get only regular content pages (excludes generated taxonomy/archive pages).
PERFORMANCE: This property is cached after first access for O(1) subsequent lookups. The cache is automatically invalidated when pages are modified.
Returns
List of regular Page objects (excludes tag pages, archive pages, etc.)list[Page]
—
generated_pages
property
Get only generated pages (taxonomy, archive, pagination pages).
PERFORMANCE: T…
generated_pages
property def generated_pages(self) -> list[Page]
Get only generated pages (taxonomy, archive, pagination pages).
PERFORMANCE: This property is cached after first access for O(1) subsequent lookups. The cache is automatically invalidated when pages are modified.
Returns
List of generated Page objects (tag pages, archive pages, pagination, etc.)list[Page]
—
listable_pages
property
Get pages that should appear in listings (excludes hidden pages).
This propert…
listable_pages
property def listable_pages(self) -> list[Page]
Get pages that should appear in listings (excludes hidden pages).
This property respects the visibility system:
- Excludes pages with
hidden: true - Excludes pages with
visibility.listings: false - Excludes draft pages
Use this for:
- "Recent posts" sections
- Archive pages
- Category/tag listings
- Any public-facing page list
Usesite.pageswhen you need ALL pages including hidden ones
(e.g., for sitemap generation where you filter separately).
PERFORMANCE: This property is cached after first access for O(1) subsequent lookups. The cache is automatically invalidated when pages are modified.
Returns
List of Page objects that should appear in public listingslist[Page]
—
get_page_path_map
Get cached page path lookup map for O(1) page resolution.
Cache is automatical…
get_page_path_map
def get_page_path_map(self) -> dict[str, Page]
Get cached page path lookup map for O(1) page resolution.
Cache is automatically invalidated when page count changes, covering add/remove operations in dev server.
Returns
Dictionary mapping source_path strings to Page objectsdict[str, Page]
—
invalidate_page_caches
Invalidate cached page lists when pages are modified.
Call this after:
- Addin…
invalidate_page_caches
def invalidate_page_caches(self) -> None
Invalidate cached page lists when pages are modified.
Call this after:
- Adding/removing pages
- Modifying page metadata (especially _generated flag or visibility)
- Any operation that changes the pages list
This ensures cached properties (regular_pages, generated_pages, listable_pages, page_path_map) will recompute on next access.
invalidate_regular_pages_cache
Invalidate the regular_pages cache.
Call this after modifying the pages list o…
invalidate_regular_pages_cache
def invalidate_regular_pages_cache(self) -> None
Invalidate the regular_pages cache.
Call this after modifying the pages list or page metadata that affects the _generated flag. More specific than invalidate_page_caches() if you only need to invalidate regular_pages.