Automating Daily Notes in Obsidian with Templater

In this article I dig into the templates I use with Templater for creating useful daily notes in Obsidian.

Automating Daily Notes in Obsidian with Templater

Managing daily notes efficiently in Obsidian has become a game-changer for my productivity. In this tutorial, I’ll walk you through how I set up and automate daily notes using the Templater plugin. Here’s a step-by-step breakdown of how I streamline my workflow using Obsidian and Templater.

Setting Up My Daily Notes

The first step in automating my daily note system is creating a folder specifically for my daily notes. I recommend creating a new folder called Daily Notes. Once that’s set up, I integrate the Daily Notes plugin from the Obsidian core plugin library.

Default Configuration

I suggest using the default naming convention, which follows the format:

  • Year-Month-Day (YYYY-MM-DD)
  • This makes it easier to locate notes chronologically.
  • Set the toggle so Obsidian opens (or creates) the daily note when it launches.

When you enable this, every time you open Obsidian, a new daily note is automatically created—like a fresh journal page. Also, remember to set the option in the Files and Links setting so that Default location for new notes is set to Same folder as current file.

Opening Your First Daily Note

To start, simply click "Open Today's Daily Note," and your new note will appear in the folder you created. At first, the page is plain, but that’s where Templater comes into play to add functionality.

Installing Templater

While Obsidian provides a basic template plugin, I prefer to dive right into the advanced Templater plugin.

  1. Navigate to Community Plugins in Obsidian.
  2. Install Templater from the list of popular plugins.
  3. Enable Templater and create a new folder for your templates (e.g., Templates).

Once Templater is set up, I can do things like date math, JavaScript commands, and more—features the basic plugin cannot handle.

Creating a Daily Note Template

Now that Templater is installed, it’s time to create a basic template for daily notes. I create a Daily Note Template that includes basic elements such as:

  • Date formatting
  • Day of the year
  • Buttons for navigating to previous and next days

Here’s an example of how my basic template looks:

# September 9th, 2024
## Monday

Day of Year: 253
***
**Prev Date**: [[2024-09-08]]
**Next Date**: [[2024-09-10]]
***

## Quotes
> "Spending time and energy trying to “motivate” people is a waste of effort. The real question is not, “How do we motivate our people?” If you have the right people, they will be self-motivated. The key is to not de-motivate them." (Jim Collins, Good to Great)


## 📝 Notes
-  Remember to call Steve.

## Tasks
- [ ] Wash Stacy's car

Adding Day of the Year with JavaScript

To make things more interesting, I use a JavaScript hack that calculates the day number of the year. This is particularly useful if you read journals or devotionals based on the day number rather than the specific date.

By using Templater’s integration with Moment.js, I include the following line to display the day number:

<% moment(tp.file.title).format("DDD") %>

This automatically calculates the day number and adds it to my daily note.

I take the automation further by adding navigation buttons that allow me to move between days seamlessly. The template uses JavaScript to calculate the previous and next days, generating clickable links like this:

<%* 
let prevDay = tp.date.now("YYYY-MM-DD", -1, tp.file.title, "YYYY-MM-DD");
let nextDay = tp.date.now("YYYY-MM-DD", 1, tp.file.title, "YYYY-MM-DD");
%>**Prev Date**: [[<% prevDay %>]]
**Next Date**: [[<% nextDay  %>]]

This ensures I can easily switch between daily notes without needing to manually search for them. The key to this code is that I'm creating variables which I will expand inline. The line works like this:

  • tp.date.now() is a function for manipulating dates. The key function for me is that it uses date math. Because Daily notes file names are dates in the format YYYY-MM-DD we can use tp.file.title as a date string for our math. The results will be the name of another valid date file.

In theory you could use any date format you want, as long as it is consistent. The difference between <%* %> and <% %> is that the asterisk tells the template engine to interpret the code as javascript. Nothing is expanded in the text file unless you call specific commands to do that. With <% %> any text will be included in the note file, but variables will be automatically expanded - which is what happens with prevDay and nextDay.

💡
There is no space between the closing of the javascript bracket %> and the start of the Prev Date link to make sure the formatting works correctly.

Integrating the Calendar Plugin

To make my daily note workflow even more efficient, I use the Calendar Plugin. This plugin allows me to visually interact with my notes on a calendar and create new daily notes for future or past dates.

Key Features of the Calendar Plugin

  • Start Weeks on Monday: I prefer to configure the calendar to start the week on Monday instead of Sunday.
  • Week Numbers: Display the week number on the calendar.

With the calendar plugin active, I can click on any date and automatically generate a new daily note using the template I created earlier. Putting Daily Notes in the future allows me to leave notes to myself or create tasks in the future I'm not ready to act on today.

Automating Daily Note Creation

One of the key benefits of this setup is automating the creation of daily notes. By using Templater and the Calendar plugin together, I can easily jump between days, and the template will automatically populate with the correct data. If you accidentally create a new note by clicking on a future (or past) date link, then you can run templater's Open Insert Modal Dialog and just run the daily note template for the empty note file and it will populate the note with the correct formatting.

Here’s a recap of my daily note setup:

  1. Daily Notes Core Plugin: Handles note creation and default folder configuration.
  2. Templater Plugin: Adds advanced functionality, such as date math and JavaScript commands.
  3. Calendar Plugin: Provides a visual way to create and navigate through daily notes.

Solving Common Issues

A common issue I’ve run into is creating a new daily note manually (outside of the calendar plugin) doesn’t apply the template correctly. To solve this, I always use the calendar plugin for note creation, ensuring the templater script runs in the right order.

Conclusion

By following this approach, you can create a seamless daily note workflow that automatically updates with relevant data like the day of the year and navigation links. Whether you’re using your daily notes for journaling, task management, or as an inbox for ideas, this system ensures you stay organized with minimal effort.

Feel free to experiment with different templates and plugins to customize the workflow to your specific needs. Happy note-taking!


By integrating Obsidian's plugins like Templater and Calendar, I’ve created a highly automated workflow that simplifies daily note-taking while maximizing functionality.


The complete Daily Note Template

Here is the code for the Daily Note Template using templater.

# <% moment(tp.file.title).format("MMMM Do, YYYY") %>
## <% moment(tp.file.title).format("dddd") %>

Day of Year: <% moment(tp.file.title).format("DDD") %>
***
<%* 
let prevDay = tp.date.now("YYYY-MM-DD", -1, tp.file.title, "YYYY-MM-DD");
let nextDay = tp.date.now("YYYY-MM-DD", 1, tp.file.title, "YYYY-MM-DD");
%>**Prev Date**: [[<% prevDay %>]]
**Next Date**: [[<% nextDay  %>]]
***

## Quotes
> 


## 📝 Notes
- 

## Tasks

There is also a YouTube Video for this content.