Functions
url_for
Generate URL for a page with base URL support.
url_for
def url_for(page: Page | Mapping[str, Any] | Any, site: Site) -> str
Generate URL for a page with base URL support.
Parameters 2
| Name | Type | Default | Description |
|---|---|---|---|
page |
Page | Mapping[str, Any] | Any |
— | Page object |
site |
Site |
— | Site instance |
Returns
URL path (clean, without index.html) with base URL prefix if configuredstr
—
with_baseurl
Apply base URL prefix to a path.
with_baseurl
def with_baseurl(path: str, site: Site) -> str
Apply base URL prefix to a path.
Parameters 2
| Name | Type | Default | Description |
|---|---|---|---|
path |
str |
— | Relative path starting with '/' |
site |
Site |
— | Site instance |
Returns
Path with base URL prefix (absolute or path-only)str
—
filter_dateformat
Format a date using strftime.
filter_dateformat
def filter_dateformat(date: datetime | str | None, format: str = '%Y-%m-%d') -> str
Format a date using strftime.
Parameters 2
| Name | Type | Default | Description |
|---|---|---|---|
date |
datetime | str | None |
— | Date to format |
format |
str |
'%Y-%m-%d' |
strftime format string |
Returns
Formatted date stringstr
—