Classes
SectionOrchestrator
Handles section structure and completeness.
Responsibilities:
- Ensure all sections have index pag…
SectionOrchestrator
Handles section structure and completeness.
Responsibilities:
- Ensure all sections have index pages (explicit or auto-generated)
- Generate archive pages for sections without _index.md
- Validate section structure
- Maintain section hierarchy integrity
This orchestrator implements the "structural" concerns of sections, separate from cross-cutting concerns like taxonomies (tags, categories).
Methods 2
finalize_sections
Finalize sections by ensuring they have index pages.
For each section:
- If it…
finalize_sections
def finalize_sections(self, affected_sections: set[str] | None = None) -> None
Finalize sections by ensuring they have index pages.
For each section:
- If it has an explicit _index.md, leave it alone
- If it doesn't have an index page, generate an archive page
- Recursively process subsections
This ensures all section URLs resolve to valid pages.
Parameters 1
affected_sections |
set[str] | None |
Set of section paths that were affected by changes. If None, finalize all sections (full build). If provided, only finalize affected sections (incremental). |
validate_sections
Validate that all sections have valid index pages.
validate_sections
def validate_sections(self) -> list[str]
Validate that all sections have valid index pages.
Returns
List of validation error messages (empty if all valid)list[str]
—
Internal Methods 11
__init__
Initialize section orchestrator.
__init__
def __init__(self, site: Site)
Initialize section orchestrator.
Parameters 1
site |
Site |
Site instance to manage sections for |
_finalize_recursive_filtered
Recursively finalize only affected sections (incremental optimization).
_finalize_recursive_filtered
def _finalize_recursive_filtered(self, section: Section, affected_sections: set[str]) -> int
Recursively finalize only affected sections (incremental optimization).
Parameters 2
section |
Section |
Section to finalize |
affected_sections |
set[str] |
Set of section paths that were affected |
Returns
Number of archive pages createdint
—
_needs_finalization
Check if a section or any of its subsections needs finalization.
A section nee…
_needs_finalization
def _needs_finalization(self, section: Section) -> bool
Check if a section or any of its subsections needs finalization.
A section needs finalization if it or any subsection lacks an index page. This is used to ensure sections are finalized even in incremental builds.
Parameters 1
section |
Section |
Section to check |
Returns
True if section or any subsection lacks an index pagebool
—
_finalize_recursive
Recursively finalize a section and its subsections.
_finalize_recursive
def _finalize_recursive(self, section: Section) -> int
Recursively finalize a section and its subsections.
Parameters 1
section |
Section |
Section to finalize |
Returns
Number of archive pages createdint
—
_detect_content_type
Detect what kind of content this section contains.
Delegates to the content ty…
_detect_content_type
def _detect_content_type(self, section: Section) -> str
Detect what kind of content this section contains.
Delegates to the content type registry's detection logic. Respects site-level default_content_type configuration.
Parameters 1
section |
Section |
Section to analyze |
Returns
Content type name (e.g., 'blog', 'doc', 'api-reference')str
—
_should_paginate
Determine if section should have pagination.
Delegates to the content type str…
_should_paginate
def _should_paginate(self, section: Section, content_type: str) -> bool
Determine if section should have pagination.
Delegates to the content type strategy's pagination logic.
Parameters 2
section |
Section |
Section to check |
content_type |
str |
Detected content type |
Returns
True if section should have paginationbool
—
_get_template_for_content_type
Get the appropriate template for a content type.
Delegates to the content type…
_get_template_for_content_type
def _get_template_for_content_type(self, content_type: str) -> str
Get the appropriate template for a content type.
Delegates to the content type strategy's template logic.
Parameters 1
content_type |
str |
Type of content |
Returns
Template namestr
—
_prepare_posts_list
Prepare the posts list for a section using content type strategy.
_prepare_posts_list
def _prepare_posts_list(self, section: Section, content_type: str) -> list[Page]
Prepare the posts list for a section using content type strategy.
Parameters 2
section |
Section |
Section to prepare posts for |
content_type |
str |
Content type of the section |
Returns
Filtered and sorted list of pageslist[Page]
—
_create_archive_index
Create an auto-generated index page for a section.
Detects content type and us…
_create_archive_index
def _create_archive_index(self, section: Section) -> Page
Create an auto-generated index page for a section.
Detects content type and uses appropriate template:
- API reference docs: api-reference/list.html (no pagination)
- CLI reference docs: cli-reference/list.html (no pagination)
- Tutorial sections: tutorial/list.html (no pagination)
- Blog/chronological: archive.html (with pagination)
- Generic sections: index.html (fallback)
Parameters 1
section |
Section |
Section that needs an index page |
Returns
Page object representing the section indexPage
—
_enrich_existing_index
Enrich an existing user-created index page with section context.
This adds the…
_enrich_existing_index
def _enrich_existing_index(self, section: Section) -> None
Enrich an existing user-created index page with section context.
This adds the same metadata that auto-generated archives get, allowing user-created index pages with type: blog or archive to work properly.
Parameters 1
section |
Section |
Section with an existing index page |
_validate_recursive
Recursively validate a section and its subsections.
_validate_recursive
def _validate_recursive(self, section: Section) -> list[str]
Recursively validate a section and its subsections.
Parameters 1
section |
Section |
Section to validate |
Returns
List of validation error messageslist[str]
—