Classes
URLStrategy
Pure utility for URL and output path computation.
Centralizes all path/URL logic to ensure consist…
URLStrategy
Pure utility for URL and output path computation.
Centralizes all path/URL logic to ensure consistency and prevent bugs. All methods are static - no state, pure logic.
Design principles:
- Pure functions (no side effects)
- No dependencies on global state
- Easy to test in isolation
- Reusable across orchestrators
Methods 6
compute_regular_page_output_path
staticmethod
Compute output path for a regular content page.
compute_regular_page_output_path
staticmethod def compute_regular_page_output_path(page: Page, site: Site, pre_cascade: bool = False) -> Path
Compute output path for a regular content page.
Parameters 3
page |
Page |
Page object (must have source_path set) |
site |
Site |
Site object (for output_dir and config) |
pre_cascade |
bool |
Returns
Absolute path where the page HTML should be writtenPath
—
compute_archive_output_path
staticmethod
Compute output path for a section archive page.
compute_archive_output_path
staticmethod def compute_archive_output_path(section: Section, page_num: int, site: Site) -> Path
Compute output path for a section archive page.
Parameters 3
section |
Section |
Section to create archive for |
page_num |
int |
Page number (1 for first page, 2+ for pagination) |
site |
Site |
Site object (for output_dir) |
Returns
Absolute path where the archive HTML should be writtenPath
—
compute_tag_output_path
staticmethod
Compute output path for a tag listing page.
compute_tag_output_path
staticmethod def compute_tag_output_path(tag_slug: str, page_num: int, site: Site) -> Path
Compute output path for a tag listing page.
Parameters 3
tag_slug |
str |
URL-safe tag identifier |
page_num |
int |
Page number (1 for first page, 2+ for pagination) |
site |
Site |
Site object (for output_dir) |
Returns
Absolute path where the tag page HTML should be writtenPath
—
compute_tag_index_output_path
staticmethod
Compute output path for the main tags index page.
compute_tag_index_output_path
staticmethod def compute_tag_index_output_path(site: Site) -> Path
Compute output path for the main tags index page.
Parameters 1
site |
Site |
Site object (for output_dir) |
Returns
Absolute path where the tags index HTML should be writtenPath
—
url_from_output_path
staticmethod
Generate clean URL from output path.
url_from_output_path
staticmethod def url_from_output_path(output_path: Path, site: Site) -> str
Generate clean URL from output path.
Parameters 2
output_path |
Path |
Absolute path to output file |
site |
Site |
Site object (for output_dir) |
Returns
Clean URL with leading/trailing slashesstr
—
make_virtual_path
staticmethod
Create virtual source path for generated pages.
Generated pages (archives, tag…
make_virtual_path
staticmethod def make_virtual_path(site: Site, *parts: str) -> Path
Create virtual source path for generated pages.
Generated pages (archives, tags, etc.) don't have real source files. This creates a virtual path under .bengal/generated/ for tracking.
Parameters 1
site |
Site |
Site object (for root_path) *parts: Path components |
Returns
Virtual path under .bengal/generated/Path
—