Functions
_ensure_page_parsed
Ensure a page is parsed if it hasn't been parsed yet.
This is used when pages are accessed via get…
_ensure_page_parsed
def _ensure_page_parsed(page: Page, site: Site) -> None
Ensure a page is parsed if it hasn't been parsed yet.
This is used when pages are accessed via get_page() from templates (e.g., track item pages) and need to be parsed on-demand.
Parameters 2
| Name | Type | Default | Description |
|---|---|---|---|
page |
Page |
— | Page to parse if needed |
site |
Site |
— | Site instance for parser access |
_build_lookup_maps
Build page lookup maps on the site object if not already built.
Creates two maps for O(1) page loo…
_build_lookup_maps
def _build_lookup_maps(site: Site) -> None
Build page lookup maps on the site object if not already built.
Creates two maps for O(1) page lookups:
- 'full': Full source path (str) -> Page
- 'relative': Content-relative path (str) -> Page
Parameters 1
| Name | Type | Default | Description |
|---|---|---|---|
site |
Site |
— | Site instance to build maps on |
page_exists
Check if a page exists without loading it.
Uses cached lookup maps for O(1) existence check.
More …
page_exists
def page_exists(path: str, site: Site) -> bool
Check if a page exists without loading it.
Uses cached lookup maps for O(1) existence check. More efficient than get_page() when you only need existence.
Parameters 2
| Name | Type | Default | Description |
|---|---|---|---|
path |
str |
— | Page path (e.g., 'guides/setup.md' or 'guides/setup') |
site |
Site |
— | Site instance |
Returns
True if page exists, False otherwisebool
—
register
Register the get_page and page_exists functions with Jinja2 environment.
register
def register(env: Environment, site: Site) -> None
Register the get_page and page_exists functions with Jinja2 environment.
Parameters 2
| Name | Type | Default | Description |
|---|---|---|---|
env |
Environment |
— | |
site |
Site |
— |