David Hellyer Sign out Sign in

Content includes

Inline local or remote content directly into a page using :::include.

Content includes

The :::include block inlines content from a local file or remote URL directly into the page at render time. The included content is processed through the full pipeline and baked into the cached page.

Syntax

::: include
path/to/file.md
:::


The optional ttl=N modifier sets the parent page cache TTL in seconds if no ttl: is set in the page front matter. Useful for pages that include frequently updated remote content.

Path resolution

Content handling by file type

.md files
Front matter stripped, body rendered as Markdown inline. The included file's title and layout front matter are ignored - only the body is used.
Code files (.sh, .pl, .py, .yml, .json, .css etc.)
Wrapped in a fenced code block with the appropriate language identifier.
.html files
Inserted bare - assumed to be a valid HTML fragment.
Unknown extensions
Wrapped in <pre> with HTML entities escaped.

Examples

Include a local Markdown partial:

::: include
partials/shared-note.md
:::

Include a remote file, refresh every 5 minutes:

::: include ttl=300
https://raw.githubusercontent.com/owner/repo/main/CHANGELOG.md
:::

Include a code file (renders as a syntax-highlighted code block):

::: include
/examples/config-sample.yml
:::

Error handling

If a local file is missing or a remote fetch fails, the block renders as a silent span with class include-error and a data-src attribute recording the failed source path. A warning is written to the error log. Expose errors during development:

.include-error::before {
  content: "include failed: " attr(data-src);
  color: red;
  display: block;
}

Notes

See also