Documentation for Templates Plugin?

Is there any documentation for the Templates Plugin? I’m not being lazy, but I can’t figure out how (or why) to use it – I have use cases in which creating new files from templates would be very helpful, but this doesn’t seem to address that. If there’s any existing documentation that would explain it, I’d sure like to see it. Thanks so much to the community!

J

1 Like

Only from personal experience messing around with it –

  • Make a folder for your templates and tell the plugin where it is
  • Make a new file and write your template, put it in the folder
  • If you want to use a template, click the button or use command palette. If you have more than one, choose the one you want.
  • {{date}} and {{time}} with https://momentjs.com/docs/#/displaying/format/
  • Long form date: {{date:dddd MMMM Do YYYY h:mm:ssa}} -> “Monday September 7th 2020 2:51:41pm”
4 Likes

Ahhh… this was enough to get me playing around with it – specifically, the reference to “click the button.” I hadn’t looked at the button sidebar for a new one! As others have noted elsewhere in the community, you need to create a new file and then click the button to select the template you want to use.

Thanks for your speedy reply @jkb!

2 Likes

You’re welcome, glad I could help! At first I was getting annoyed with the sidebar button not working, I didn’t check the Templates plugin config pop up below Community themes

Do you know where I could read about more advanced template creation? For example I would like to create a link to yesterday at my daily notes, I’m failing to find documentation about this

Actually what programming languages the plugins are using?

Hope this helps: https://publish.obsidian.md/help/Plugins/Templates

2 Likes

even I’m looking to create a template that can add yesterday’s date automatically. Did you find anything?

I recently started using the Templater plugin.

On my daily notes, I have a section at the top which links to the days before and after the current daily note. It looks something like this:

<< [[Yesterday]] | Today | [[Tomorrow]] >>

To automatically link to the previous daily note, you can make use of the built-in function: {{tp_yesterday}}, which returns the previous day’s date formatted as: YYYY-MM-DD.
Now, depending on how you choose to name your daily notes, you can create a link to them using this function.
I name my daily notes as "YYYY-MM-DD DN", so to link to them, I have the following line in my daily note template:

[[{{tp_yesterday}} DN|Yesterday]] which Templater returns as [[2020-12-17 DN|Yesterday]]

To do the same thing for tomorrow’s note:

[[{{tp_tomorrow}} DN]]

I hope this helps :slight_smile:

1 Like