Enable JavaScript templates
Turn on the JavaScript Templates gate so Eta template documents and `js` frontmatter entries run on this device.
JavaScript templates is a per-device gate that lets JavaScript run inside your templates. It is disabled by default.
In ZotLit 2.1 the language lived in the file name: zotlit-note.eta.md was an
Eta template and zotlit-note.liquid.md was a Liquid one. A 2.2 template
document declares its language in its own manifest instead, with the key
language: eta.
A managed frontmatter entry declares its language with its value member: expr
(Liquid), value (JSON-e), or js (JavaScript). See
Profile document for the manifest
keys and the three entry members.
What the gate covers
- Eta template documents. A profile document, a citation text, or a partial whose manifest sets
language: eta. jsfrontmatter entries. A managed frontmatter entry whose value member isjs.
The expr and value members stay active whether the gate is on or off. While
the gate is off, an Eta document is never compiled and a js entry never
evaluates.
Understand the implications first
Eta templates run JavaScript with the same access as ZotLit itself: they can read and modify your vault, connect to the internet, and on desktop, access your system. Read JavaScript templates for the full explanation before opting in.
Turn on
Open the template engine settings
In Obsidian, open Settings > ZotLit > Advanced. Locate the Template engine group and its JavaScript templates row.
Click Turn on
Click the Turn on button. A confirmation modal titled Enable JavaScript templates? appears with the following warning:
Eta templates run JavaScript with the same access as ZotLit itself: they can read and modify your vault, connect to the internet, and on desktop, access your system. Only enable this if you trust every template file in your vault.
Click Enable to confirm.
The gate takes effect immediately. ZotLit recompiles the template folder in place. No plugin reload is needed.
Turn off
In the same JavaScript templates group, click Turn off. The gate disables immediately with no confirmation modal. Every template document that declares language: eta becomes inert, and every managed frontmatter entry declared with js stops evaluating until you turn the gate back on.
Per-device scope
The setting is stored locally on the device, outside the synced plugin data. Enabling it on one device does not enable it on another. Each device where you want Eta documents and js entries to run requires its own opt-in.
See also
JavaScript templates
What the gate enables, risks, and behavior when disabled.
Profile document
The manifest keys, the note source, and the Annotation Section.
Customize a template
Edit a template document and switch its language to Eta.
How templates work
The three template document kinds, their filenames, and the two languages.
Last updated on