Module

rendering.pipeline.output

Output handling for rendering pipeline.

Provides output path determination, template selection, and file writing.

Related Modules:

  • bengal.rendering.pipeline.core: Uses these output utilities
  • bengal.utils.url_strategy: URL computation
  • bengal.utils.atomic_write: Atomic file writing

Functions

determine_output_path
Determine the output path for a page. Delegates path computation to centralized URLStrategy (i18n-…
2 Path
def determine_output_path(page: Page, site: Any) -> Path

Determine the output path for a page.

Delegates path computation to centralized URLStrategy (i18n-aware).

Parameters 2

Name Type Default Description
page Page

Page to determine path for

site Any

Site instance

Returns

Path

Output path

determine_template
Determine which template will be used for this page. Template resolution order: 1. page.template a…
1 str
def determine_template(page: Page) -> str

Determine which template will be used for this page.

Template resolution order:

  1. page.template attribute
  2. page.metadata['template']
  3. Default based on page type

Parameters 1

Name Type Default Description
page Page

Page object

Returns

str

Template name (e.g., 'single.html', 'page.html')

write_output
Write rendered page to output directory. Handles: - Directory creation with caching (reduces sysca…
3 None
def write_output(page: Page, site: Any, dependency_tracker: Any = None) -> None

Write rendered page to output directory.

Handles:

  • Directory creation with caching (reduces syscalls)
  • Atomic writes for crash safety (optional)
  • Fast writes for dev server performance
  • Source→output tracking for incremental cleanup

Parameters 3

Name Type Default Description
page Page

Page with rendered content

site Any

Site instance for config

dependency_tracker Any None

Optional tracker for output mapping

format_html
Format HTML output (minify/pretty). Respects page-level and site-level configuration: - page.metad…
3 str
def format_html(html: str, page: Page, site: Any) -> str

Format HTML output (minify/pretty).

Respects page-level and site-level configuration:

  • page.metadata.no_format: Skip formatting
  • site.config.html_output.mode: 'minify', 'pretty', or 'raw'
  • site.config.minify_html: Legacy option

Parameters 3

Name Type Default Description
html str

Rendered HTML content

page Page

Page being rendered

site Any

Site instance for config

Returns

str

Formatted HTML