range
Returns a list of the specified range.
Parameters:
start: optional. Defaults to 0; the starting value.end: required. The ending value (exclusive).step_by: optional. Defaults to 1; the step increment.
now
Returns the current time as a date string or timestamp.
Parameters:
timestamp: optional. Defaults tofalse; whether to return a timestamp.utc: optional. Defaults tofalse; whether to return UTC time.
random
Generates a random number in the range [start, end).
Parameters:
start: optional. Defaults to 0. The minimum value.end: the maximum value (exclusive).
env
Returns the system environment variable with the specified name.
Parameters:
name: the variable name.default: a default value to use if the variable does not exist.
asset
Outputs a static asset reference. Depends on assets-manifest.json in the template directory, typically generated by the webpack plugin
webpack-assets-manifest.
Plugin configuration:
new WebpackAssetsManifest({
publicPath: true,
entrypoints: true,
output: 'assets-manifest.json',
}),
Parameters:
type: the assets type. Valid values:jsorcss.section: the entrypoint name.cdn: optional. The CDN prefix to use for this asset. Note: the CDN prefix is only applied to non-absolute paths.
imgsrc
Returns the URL of a bundled image. Data comes from the img-manifest.json file, commonly produced by the Webpack Manifest plugin after bundling assets.
{# Explicit function call #}
<img src="{{ imgsrc(file="a/b/logo.png") }}" />
{# Syntactic sugar for the function above; automatically converts addresses starting with "@" #}
<img src="@a/b/logo.png" />
Parameters:
file: the file path.
When a file with a language code suffix exists, it will be used preferentially.
For example, when the startup parameter is set to --lang=en_US:
img-manifest.json
{
"assets/img/arrow-down.png": "assets/img/arrow-down.9685e4b1.png",
"assets/img/arrow-down.en_US.png": "assets/img/arrow-down.9685e4b1.en_US.png"
}
Template
<img src="{{img_src(file='assets/img/arrow-down.png')}}" />
Output
<img src="assets/img/arrow-down.9685e4b1.en_US.png" />
t
Multilingual output.
<div class="">{{ t(text="meta description", memo="hello world") }}</div>
<div class="">{{ t(text="memo/body2 ") }}</div>
<script>var msg = "hello {{ __T_my name__ }}";</script>
Syntactic sugar: T__label, commonly used in JS strings, where label is the language key.
text: the language content.memo: optional. A content annotation.
data
Specifies a data source. Supports JSON, YAML, and TOML formats; data is automatically converted to an object after loading (by default, based on the file extension). The data source can be a local file in the template directory or a remote URL.
Parameters:
src: the data source address.format: optional; inferred from the file extension. The parsing format for the returned content. Valid values:json,yaml,toml,csv.bearer: optional. An OAuth token.post: optional. Defaults tofalse; whether to use a POST request.json_payload: optional. The JSON data object to send with the POST request.csv_delimiter: optional. The CSV delimiter; defaults to,.cache_secs: optional. The cache duration in seconds. No caching by default.
script
JavaScript script extension. The script's return value can be a primitive type or a JSON object. Example:
{% set hi_js = `
function sayHello(name){
return `hello ${name}`
}
sayHello(args.name)
` %}
<p>{{script(content=hi_js, name=file.name)}}</p>
Parameters:
content: the script content.file: the script filename. Scripts must be placed in the template directory under_everkm/_js/.- Additional key-value pairs are converted to properties of the JS global variable
args.
The content and file parameters are mutually exclusive -- provide one or the other.
base_url
Outputs the URL prefix for exported pages, commonly used when deploying to a subdirectory after export.
post_meta
Returns the metadata for a specified piece of content.
Parameters
path: the content file path.
Return format
| Key | Meaning | Type | Optional | Notes |
|---|---|---|---|---|
| id | ID | string | Commonly used for parameter passing. | |
| title | Title | string | ||
| dir | Directory | string | Has / characters on both ends. | |
| path | File path | string | ||
| url_path | Frontend URL path | string | ||
| slug | File slug | string | Defaults to URL-encoded title. | |
| summary | Summary | string | ||
| created_at | Created time | integer (epoch seconds) | Legacy alias date is still supported. | |
| updated_at | Updated time | integer (epoch seconds) | yes | Alias updated. |
| draft | Is draft | boolean | ||
| tags | Tag set | array of strings | ||
| weight | Weight | integer | yes | |
| meta | Meta properties | object | yes | Front matter keys not listed above are nested under meta. |
post_detail
Content detail.
Parameters
path: required. The content file path.lazy_img: optional. Lazy loading for images.exclude_tags: optional. Tags whose content blocks should be excluded. Separate multiple tags with spaces; defaults to includingprivate(corresponds to the Markdown{#private}block). Note: when a matched tag is a heading, that heading, its sub-headings, and all content under them will be omitted.
Return format
In addition to the content metadata fields, the following is added:
| Key | Meaning | Type | Optional | Notes |
|---|---|---|---|---|
| content_html | The full content converted to HTML | string |
has_post
Checks whether content exists.
Parameters
path: the content path.
posts
Returns a list of posts matching the specified criteria. Format matches post_meta.
Default sort order: weight descending, updated_at descending, title ascending, created_at ascending.
Parameters
dir: optional. Filter by directory.tags: optional. Filter by tags.exclude_tags: optional. Exclude posts by tags; defaults to includingprivate.categories: optional. Filter by categories.recursive: optional. Defaults tofalse. Whether to include all descendant directories when filtering by directory.order_by: optional. Sort field. Valid values:default,updated_at,date(by creation time),title.order_direction: optional. Sort direction. Valid values:asc,desc.
Environment Variables
EVERKM_DRAFT: when set to1, returns all content including drafts; defaults to0.EVERKM_PRIVATE: in preview mode, when set to1, disables the system's defaultprivateexclusion (both{#private}content blocks and posts with theprivatetag); export is not affected.
posts_tag_list
Returns a list of tags and their corresponding file counts.
Parameters
| Parameter | Meaning | Type | Optional | Notes |
|---|---|---|---|---|
| dir | Directory | string | yes | Starts with / |
Returns
{
"<tag>": 1,
}
posts_category_list
Returns a list of categories and their corresponding file counts.
Parameters
| Parameter | Meaning | Type | Optional | Notes |
|---|---|---|---|---|
| dir | Directory | string | yes | Starts with / |
Returns
{
"<category>": 1,
}
posts_directory_list
Gets a set of directories matching the specified criteria.
Parameters
| Parameter | Meaning | Type | Optional | Notes |
|---|---|---|---|---|
| dir | Directory | string | yes | Starts with / |
| max_depth | Maximum depth | positive int | yes | / is level 1 |
| prefix | Path prefix | string | yes | Starts with / |
Returns
An array of strings, sorted in lexicographic order.
[
"/blog/2013/",
"/docs/",
]
media_remote
Localizes remote image, audio, and video resources.
Parameters
url: the remote address.
Returns
An object.
| Key | Meaning | Type | Optional | Notes |
|---|---|---|---|---|
| url | Local address | string |
media_dimension
Returns the dimensions of an image.
Parameters
file: the absolute file path.
Return format
An object.
| Key | Meaning | Type | Optional | Notes |
|---|---|---|---|---|
| width | Width | number | ||
| height | Height | number |
nav_indicator
Returns the previous and next items of the current page within the navigation tree.
Parameters
from_file: the navigation tree file path. Can be an ordinary path string, or use[[...]]internal link syntax to reference a target Markdown file (same rules as in-body internal links; see Links and Inner Links).
Return format
{
"prev": { // optional
"title": "Title",
"link": "URL"
},
"next": { // optional
"title": "Title",
"link": "URL"
},
}
page_query
Modifies and outputs the current page's query parameters.
Parameters
All input parameters update (override) existing parameters with the same name.
Returns
The modified key-value parameter pairs in application/x-www-form-urlencoded format.
oops
Terminates template processing and displays an error message.
Parameters
| Key | Meaning | Type | Optional | Notes |
|---|---|---|---|---|
| message | Error message | string |
config
Gets a configuration value related to the current context language.
Parameters
| Key | Meaning | Type | Optional | Notes |
|---|---|---|---|---|
| key | Key name | string | For nested keys, use / as separator; must start with /. Follows RFC6901 (e.g., /site/name). | |
| default | Default value | same as system constant types | yes |
Returns
The value of the specified key under __config in the everkm.yaml configuration file.
has_config
Checks whether a configuration item exists.
Parameters
| Key | Meaning | Type | Optional | Notes |
|---|---|---|---|---|
| key | Key name | string | Same as config. |
Returns
A boolean value.
media
References a media file, such as audio, video, PDF documents, etc.
Parameters
| Key | Meaning | Type | Optional | Notes |
|---|---|---|---|---|
| file | File path | string | Relative paths are resolved from the containing Markdown file's directory. |
Returns
A URL. The media file is also automatically bundled into the output directory during publishing.
nav_tree
Parses a navigation tree structure from the specified navigation file (typically a Markdown file). Suitable for books, documentation, and other hierarchical navigation scenarios.
Parameters
from_file: required. The navigation file path. Supports[[...]]internal link syntax (see Links and Inner Links).__page_path: internal parameter; the current page path (automatically injected by the template context).
Returns
{
"nodes": [ // Navigation tree nodes
{
"title": "Node Title",
"link": "URL",
"children": [ /* Child nodes with the same structure */ ]
}
],
"paths": [ // Current page's path in the navigation tree (breadcrumbs)
{ "title": "Title", "url": "URL" }
]
}
nav_path
Gets the current page's path (breadcrumbs) within the navigation tree, with support for merging page-level breadcrumbs.
Parameters
from_file: required. The navigation file path. Supports[[...]]internal link syntax (see Links and Inner Links).merge: optional. A page-level breadcrumb array that will be merged and deduplicated with the navigation path.__page_path: internal parameter; the current page path (automatically injected by the template context).
Returns
An array of LinkItem objects.
[
{ "title": "Title", "url": "URL" },
]
post_neighbors
Given the same filtering/sort conditions as posts(), queries the previous and next post IDs relative to the specified post.
Parameters
id: required. The current post ID.- Other parameters are the same as the
postsfunction (dir,tags,recursive,order_by, etc.).
Returns
{
"prev_id": "Previous post ID (may be null)",
"next_id": "Next post ID (may be null)"
}
lang
Returns the currently active language code.
Parameters
None.
Returns
A string, e.g., zh_CN, en_US.
asset_base_url
Outputs the CDN prefix for static assets. Used to add a CDN prefix to resource references during export.
Parameters
url: optional. If provided and starts with~/, the~is replaced with the CDN prefix before returning.
Returns
The CDN prefix string, or the transformed URL.