Live Templates are a type of block that render Templates written in Template Language inline in a page.

There are two variants of Live Templates:

  • template: where the template is specified inline in a code block.
  • include: where an external page (template) is included and rendered.

Template blocks are specified using Markdown‘s fenced code block notation using either template or include as its language. They can also be baked.

Template

To specify a template to render inline, you can use the template block. The body is written in Template Language.

Today is {{today}}

Include

warning Deprecated, use templates instead
Include template are primarily here to be a drop-in replacement for the old style template blocks, see below for a suggestion how to use those instead.

A template block is configured using YAML in its body. The following attributes are supported:

  • page: the page to use as a template
  • value: an (optional) value to pass to the template
  • raw: a page reference to include in the page without processing it as a template.

Here’s an example using page:
page: "[[internal-template/today]]"

If you want to include another page (not necessarily a template). unprocessed (so without replacing template placeholders), you can use raw:
raw: "[[internal/test page]]"

Recommended alternative

Instead of using the include block we recommend you use a {{template([[template]])}} directive in a template instead as it is more flexible and more natural.

Look for yourself:
{{template([[internal-template/today]])}}