Auto-Insert Templates

From v3.14, you can select a template to be automatically inserted into new calendar notes. This works for daily, weekly, monthly, quarterly, or yearly notes when you first create them. The feature activates when you open a new note or drag a task into a new day. However, it doesn't apply to existing notes (with or without content). Existing means here that the file for the note already exists.
You can choose a specific template for each type of calendar note, or open the template directly and click top right on the repeat button. NotePlan will add an entry to the frontmatter of the selected template, allowing it to identify which template to use for each note type. 

1. Select a Template from a Calendar Note

To set up auto-insert templates:
  1. Open an empty calendar note on Mac or iOS.
  2. Click "Insert Template" and choose "Auto-Insert".
  3. Select a template.

The chosen template will be saved for that specific calendar note type (daily, weekly, etc.). For example, the selected template will be used for all future daily notes if you're in a daily note, weekly if you are in a weekly note, etc.

To un-select a template, you can follow the same process and click on the checked template again to "uncheck" it.

2. Setup a Template Directly

Open the template and click on the repeat button on the top right:

A dialog opens with a few options. Select the "Insert Into" option to "Daily" to reveal more preferences:

"Insert Into" means the calendar note into which the template should be auto-inserted. The most flexible is the daily notes option.

Frontmatter

If you need more fine-grained control over your auto-insert templates, you can edit the frontmatter in your templates directly, circumventing the user interface. Here, you can also define multiple templates for different days, or overlapping days (means multiple templates for the same date). For example, if you need one template for weekdays, but another for the weekend, you might want to use the following repeat field inside your template frontmatter:

repeat: note = day, freq = week, on = [mon, tue, wed, thu, fri]

This will select the template only for weekdays. Another template could contain the following for the weekend days:

repeat: note = day, freq = week, on = [sat, sun]

If you in addition to the previous two need something in your templates independently of the date (overlapping with the two previous), you can use:

repeat: note = day

This template will be added to the other two. You can also define the order by adding order = 1 for example.

Note: The template type has to be empty or contain calendar-note or empty-note.

The following fields are available behind the "repeat:" key:

  • note: The calendar note type, means daily, weekly, etc. (values: day, week, month, quarter, year)
  • freq: Frequency of repetition, means every day, every week, etc. (values: day, week, month, quarter, year)
  • on: Specify the list of days for weekly, monthly, or yearly frequencies (the values have to be added as a list, means inside square brackets like [mon, tue])
    • For the weekly frequency use days of week: mon, tue, wed, thu, fri, sat, sun (example: [sat, sun])
    • For monthly, you can use the number of the day in a month: 1, 2, 3 ..., 31 (example: [1, 2, 30])
    • For yearly, use month-day (MM-DD) pairs: from 01-01 to 12-31 (example: [12-24, 09-23])
  • order: If you have multiple templates matching for a day, then this will determine in which order they will be added. Use a simple number, like 1, 2, 3...
  • async: If the template is executing functions that need some time to run like "listTodaysEvents" or fetching something from the internet or prompting you to type in something, you can add "async = true", so NotePlan will wait until the template is fully processed. This is mostly needed when you run multiple templates, so they wait for each other.

A complete template looks like this for example:

---
repeat: note = day
title: Daily Planning
type: calendar-note
---


## Today's Goals
> 




## Tasks

Asynchronous Functions in Templates

For example "listTodaysEvents" or web calls or prompts. If you are using these in your template, add "async = true" to the "repeat" line, so NotePlan waits for the template. This is only needed if you are inserting multiple templates into the same day.