1
0
silverbullet/website/Slash Templates.md
2023-11-11 14:28:46 +01:00

1.0 KiB
Raw Blame History

Slash templates allow you to define custom Slash Commands that expand “snippet style” templates inline. Theyre like 🔌 Template$snippets, but appear immediately as slash commands.

Definition

You can define a slash template by creating a Templates with a template tag and trigger attribute.

Example:

---
tags: template
trigger: meeting-notes
---
## Meeting notes for {{today}}!

|^|

Use

You can trigger the slash template by typing /meeting-notes in any page. Thats it.

Frontmatter

A templates Frontmatter is interpreted by SilverBullets template engine and removed when instantiated. However, to still include frontmatter after instantiation, you can use the frontmatter attribute.

Example:

---
tags: template
trigger: meeting-notes
frontmatter: |
   date: {{today}}
---
## Meeting notes for {{today}}!

|^|

Which will expand into e.g.

---
date: 2023-11-11
---
## Meeting notes for 2023-11-11

.