Classes
PageExplainer
Generate explanations for how pages are built.
Provides complete traceability for any page includi…
PageExplainer
Generate explanations for how pages are built.
Provides complete traceability for any page including source info, template chain, dependencies, cache status, and diagnostics.
Creation:
Direct instantiation: PageExplainer(site, cache=None, template_engine=None)
- Created by CLI explain command
- Requires Site instance with discovered content
Attributes
| Name | Type | Description |
|---|---|---|
site |
— | Site instance with pages and configuration |
cache |
— | Optional BuildCache for cache status |
template_engine |
— | Optional TemplateEngine for template resolution Thread Safety: Thread-safe. Read-only operations only. |
Methods 1
explain
Generate complete explanation for a page.
explain
def explain(self, page_path: str, verbose: bool = False, diagnose: bool = False) -> PageExplanation
Generate complete explanation for a page.
Parameters 3
page_path |
str |
Path to the page (relative to content dir or source_path) |
verbose |
bool |
Include additional details (timing, template variables) |
diagnose |
bool |
Check for issues (broken links, missing assets) |
Returns
PageExplanation with all available informationPageExplanation
—
Internal Methods 15
__init__
Initialize the page explainer.
__init__
def __init__(self, site: Site, cache: BuildCache | None = None, template_engine: TemplateEngine | None = None) -> None
Initialize the page explainer.
Parameters 3
site |
Site |
Site instance with pages and configuration |
cache |
BuildCache | None |
Optional BuildCache for cache status introspection |
template_engine |
TemplateEngine | None |
Optional TemplateEngine for template resolution |
_find_page
Find a page by path.
Searches by:
1. Exact source_path match
2. Relative path …
_find_page
def _find_page(self, page_path: str) -> Page | None
Find a page by path.
Searches by:
- Exact source_path match
- Relative path match (without content/ prefix)
- Partial path match (filename or partial path)
Parameters 1
page_path |
str |
Path to search for |
Returns
Page if found, None otherwisePage | None
—
_get_source_info
Get source file information.
_get_source_info
def _get_source_info(self, page: Page) -> SourceInfo
Get source file information.
Parameters 1
page |
Page |
Returns
SourceInfo
_resolve_template_chain
Resolve the complete template inheritance chain.
_resolve_template_chain
def _resolve_template_chain(self, page: Page) -> list[TemplateInfo]
Resolve the complete template inheritance chain.
Parameters 1
page |
Page |
Page to resolve templates for |
Returns
List of TemplateInfo in inheritance order (child first)list[TemplateInfo]
—
_get_template_name
Get the template name for a page.
_get_template_name
def _get_template_name(self, page: Page) -> str | None
Get the template name for a page.
Parameters 1
page |
Page |
Returns
str | None
_resolve_chain_from_engine
Resolve template chain using the template engine.
_resolve_chain_from_engine
def _resolve_chain_from_engine(self, template_name: str) -> list[TemplateInfo]
Resolve template chain using the template engine.
Parameters 1
template_name |
str |
Returns
list[TemplateInfo]
_get_theme_from_path
Extract theme name from template path.
_get_theme_from_path
def _get_theme_from_path(self, template_path: Path | None) -> str | None
Extract theme name from template path.
Parameters 1
template_path |
Path | None |
Returns
str | None
_extract_extends
Extract extends directive from Jinja2 template.
_extract_extends
def _extract_extends(self, content: str) -> str | None
Extract extends directive from Jinja2 template.
Parameters 1
content |
str |
Returns
str | None
_extract_includes
Extract include directives from Jinja2 template.
_extract_includes
def _extract_includes(self, content: str) -> list[str]
Extract include directives from Jinja2 template.
Parameters 1
content |
str |
Returns
list[str]
_get_dependencies
Get all dependencies for a page.
_get_dependencies
def _get_dependencies(self, page: Page) -> DependencyInfo
Get all dependencies for a page.
Parameters 1
page |
Page |
Returns
DependencyInfo
_extract_asset_refs
Extract asset references from content.
_extract_asset_refs
def _extract_asset_refs(self, content: str) -> list[str]
Extract asset references from content.
Parameters 1
content |
str |
Returns
list[str]
_get_shortcode_usage
Extract shortcode/directive usage from page content.
_get_shortcode_usage
def _get_shortcode_usage(self, page: Page) -> list[ShortcodeUsage]
Extract shortcode/directive usage from page content.
Parameters 1
page |
Page |
Returns
list[ShortcodeUsage]
_get_cache_status
Get cache status for a page.
_get_cache_status
def _get_cache_status(self, page: Page) -> CacheInfo
Get cache status for a page.
Parameters 1
page |
Page |
Returns
CacheInfo
_get_output_info
Get output information for a page.
_get_output_info
def _get_output_info(self, page: Page) -> OutputInfo
Get output information for a page.
Parameters 1
page |
Page |
Returns
OutputInfo
_diagnose_issues
Diagnose potential issues with a page.
_diagnose_issues
def _diagnose_issues(self, page: Page) -> list[Issue]
Diagnose potential issues with a page.
Parameters 1
page |
Page |
Returns
list[Issue]