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 File.md
. 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.
// _date_time_template.md
# {{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
Example
First we create a file called TestDateTimeFile.
Figure 1. Creating a new file with the fileName
“TestDateTimeFile”.
Then we insert the template _date_time_template
:
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