Functions
transform_internal_links
Transform internal links to include baseurl prefix.
This function finds all ``<a href="/...">`` an…
transform_internal_links
def transform_internal_links(html: str, baseurl: str) -> str
Transform internal links to include baseurl prefix.
This function finds all<a href="/...">and<img src="/...">tags
where the path starts with "/" and prepends the baseurl.
Parameters 2
| Name | Type | Default | Description |
|---|---|---|---|
html |
str |
— | Rendered HTML content |
baseurl |
str |
— | Base URL prefix (e.g., "/bengal" or "https://example.com/bengal") |
Returns
HTML with transformed internal linksstr
—
should_transform_links
Check if link transformation should be applied.
Link transformation is enabled when:
1. baseurl is…
should_transform_links
def should_transform_links(config: dict[str, Any]) -> bool
Check if link transformation should be applied.
Link transformation is enabled when:
- baseurl is configured (non-empty)
- transform_links is not explicitly disabled
Parameters 1
| Name | Type | Default | Description |
|---|---|---|---|
config |
dict[str, Any] |
— | Site configuration dict |
Returns
True if links should be transformedbool
—
get_baseurl
Get normalized baseurl from config.
get_baseurl
def get_baseurl(config: dict[str, Any]) -> str
Get normalized baseurl from config.
Parameters 1
| Name | Type | Default | Description |
|---|---|---|---|
config |
dict[str, Any] |
— | Site configuration dict |
Returns
Normalized baseurl string or empty stringstr
—