Robert's Homepage

How to Use Filename for Heading in Obsidian Templates


A note in Obsidian is just a file system file. The file has a fileName such as: My Inside of Obsidian, the fileName is know as the title of a given note. When building your own templates you can use variables to insert content when the template is used.

For example, consider the following template.


# {{title}}
Links: [[Templates]]
Date: {{date}} 
Time: {{time}}

When you create a new file for Obsidian with a given fileName, the {{title}} variable in the template will be substituted with the value for fileName. Here also we are using the {{date}} and {{time}} variables provided by Obsidian. For more variables see the documentation


First we create a file called TestDateTimeFile.

A screenshot of an empty Obsidian note with the title TestDateTimeFile

Figure 1. Creating a new file with the fileName “TestDateTimeFile”.

Then we insert the template _date_time_template:

Using the Command + P prompt to select the insert template option in Obsidian. After selecting the empty note auto populates with the file name as the first heading

Figure 2. Using the CMD + P command window we can insert the _date_time_template and it auto populates according to the templates variables.howtousefile