Saltar a contenido

Templates

Templates are reusable note skeletons stored in your vault's templates/ folder. They let you stamp out consistently structured notes (meeting agendas, journal entries, project plans, or anything else you use repeatedly) without starting from a blank page every time.


Creating a template

From the command bar:

:templateAdd meeting-notes

Or open the command palette (ctrl+p) and search for "Create a new Template".

Fern creates templates/meeting-notes.md (using your configured extension) and opens it for editing. Write whatever structure you want the template to have, then save with :w.


Template variables

Inside a template file you can include placeholder variables using double-brace syntax:

{{VARIABLE_NAME}}

When the template is applied, Fern fills in the known variables automatically and prompts you to supply values for any custom ones.

Built-in variables

Variable Output Example
{{DATE}} Today's date in YYYY-MM-DD format 2026-04-05
{{DATE:DD MMMM YYYY}} Today's date in a custom format 05 April 2026
{{DATE+7d}} A date offset from today (see below) 2026-04-12
{{WEEKSTART}} Date of the first day of the current week 2026-04-20
{{WEEKNO}} ISO week number of the current week 14
{{TITLE}} The name of the note being created project-kickoff

Date format tokens

Token Meaning Example
YYYY 4-digit year 2026
YY 2-digit year 26
MMMM Full month name April
MMM Abbreviated month Apr
MM Zero-padded month number 04
M Month number, no padding 4
DD Zero-padded day 05
D Day, no padding 5
dddd Full weekday name Sunday
ddd Abbreviated weekday Sun
HH 24-hour hour 14
mm Minutes 30
ss Seconds 00

Date offsets

You can shift a {{DATE}} variable forward or backward relative to today by adding an offset directly inside the braces:

{{DATE+<amount><unit>}}
{{DATE-<amount><unit>}}
{{DATE+<amount><unit>:<format>}}
Unit Meaning
d Days
w Weeks
m Months
y Years

Examples:

Variable Output (if today is 2026-04-23)
{{DATE+7d}} 2026-04-30
{{DATE-1m}} 2026-03-23
{{DATE+2w:DD MMMM YYYY}} 07 May 2026
{{DATE-1y:YYYY}} 2025

The offset and format specifier can be combined in any order: offset first, then :format.

A practical use in a project-kickoff template:

# {{TITLE}}

**Opened:** {{DATE}}
**Due:** {{DATE+30d:DD MMMM YYYY}}
**Review:** {{DATE+14d}}

Week start date

{{WEEKSTART}} resolves to the date of the first day of the current week, formatted as YYYY-MM-DD by default. Which day is "first" follows your week_start setting (monday by default, or sunday).

It accepts the same format and offset syntax as {{DATE}}:

Variable Output (week of 2026-04-20, monday start)
{{WEEKSTART}} 2026-04-20
{{WEEKSTART:dddd DD MMMM}} Monday 20 April
{{WEEKSTART+1w}} 2026-04-27
{{WEEKSTART-1w:DD MMM}} 13 Apr

A typical weekly journal template:

# Week {{WEEKNO}} ({{WEEKSTART}} - {{WEEKSTART+6d}})

## Goals

## Log

## Retrospective

Custom variables

Any {{NAME}} that is not one of the built-in variables is treated as a custom variable. When you apply the template, Fern presents a small prompt asking you to fill in each unknown variable before the note is created.

For example, a template containing:

# Meeting: {{TOPIC}}

**Date:** {{DATE}}
**Facilitator:** {{MTG_OWNER}}

Will prompt for TOPIC and MTG_OWNER, then substitute them along with today's date.

Loops

Loops let you repeat a block of template content a fixed number of times, with an index variable you can use inside the block.

{{LOOP:spec}}
...body...
{{ENDLOOP}}

The spec controls the range and an optional custom index name:

Spec Iterations Index values
{{LOOP:5}} 5 0, 1, 2, 3, 4
{{LOOP:1..5}} 5 1, 2, 3, 4, 5
{{LOOP:0..8..2}} 5 0, 2, 4, 6, 8
{{LOOP:1..5:N}} 5 1, 2, 3, 4, 5 (index named N)

Inside the loop body, {{I}} (or your custom name) is replaced with the current index value. The index can also be used as a date offset by appending a unit directly after the variable:

{{ WEEKSTART+{{I}}d }}

This inserts the date that is I days after the week start — no extra syntax needed.

A practical example that generates a full week header for each day:

{{ LOOP:0..6}}
{{ DATE+{{I}}d:dddd }}: Cooookies allowed is {{I}}
{{ENDLOOP}}

Which expands (for a Monday-start week of 2026-04-20) to:

Monday: Cooookies allowed is 0
Tuesday: Cooookies allowed is 1
Wednesday: Cooookies allowed is 2
Thursday: Cooookies allowed is 3
Friday: Cooookies allowed is 4
Saturday: Cooookies allowed is 5
Sunday: Cooookies allowed is 6

A complete weekly journal template using loops might look something like this:

# Week {{WEEKNO}} ({{WEEKSTART}} - {{WEEKSTART+6d}})

{{ LOOP:0..6}}
## {{ WEEKSTART+{{I}}d:dddd }} - {{ WEEKSTART+{{I}}d:DD MMM }}

{{ENDLOOP}}

## Goals

## Retrospective

Using a template

There are two ways to apply a template, both accessible from the command palette (ctrl+p):

Create a new note from a template

  1. Open the command palette with ctrl+p.
  2. Search for "Create a new Note from Template".
  3. Type the name for the new note and press Enter.
  4. Select the template you want to use.
  5. If the template has custom variables, fill them in at the prompt.

Fern creates the new note with all variables substituted and opens it.

Insert a template at the cursor

Use this to paste template content into a note you are already editing.

  1. Open the command palette with ctrl+p.
  2. Search for "Insert Template".
  3. Select the template.
  4. Fill in any custom variables at the prompt.

The rendered template content is inserted at the current cursor position.


Journal templates

Fern uses four special template files to scaffold new journal entries:

Journal period Template file
Daily templates/daily
Weekly templates/weekly
Monthly templates/monthly
Yearly templates/yearly

These files, like all other templates, have no extension. Create them with a text editor or by opening the path directly:

:templateOpen daily

When you open a journal entry that does not exist yet (for example with:journalOpen today), Fern copies the corresponding template, substitutes the built-in variables, and opens the new entry. If no template file exists, the new entry starts empty.

A minimal weekly template:

# Week {{WEEKNO}} - {{DATE:MMMM YYYY}}

## Reflection

## Log

## Next Steps

Auto-creating period journals on startup

With auto_journal_periods = true in your config, Fern checks at startup whether today is a period boundary (Monday for weekly, 1st of the month, January 1st). If so, it opens the corresponding journal entry automatically. This only fires when the matching journal template exists.


Managing templates from the Command Bar

Command Action
:templateAdd <name> Create a new template
:templateOpen <name> Open an existing template for editing
:templateRename <name> Rename the current template
:templateDelete <name> Delete a template

Templates available appear in the sidebar under the Templates section. They can also be found the in list of Templates populated during relevent actions from the Command Palette.