A Template for Daily Notes

Nice. Do you manually replace the YYYYMMDD part with the appropriate dates on each note, or are you able to automate that somehow?

1 Like

I use a different approach now dude, but Iā€™m pretty sure it populates if you have a few of the correct plugins. Maybe templater? Not sure, Iā€™m green on this stuff :slight_smile:

1 Like

Ah, ok. Iā€™ll poke around a bit and see if I can get it working. Thanks!

Templater lets you insert the correct previous/next dates for future days.

I think core now does yesterday and today. Not sure if thatā€™s also for future days.

Hi @EleanorKonik , Thank you for these. Some of your ideas have completely changed the way I think! Very grateful.

I was playing around the CLI javascript to collate text from a specific heading in daily notes. And ran into multiple errors. I am a noob when it comes to any programming, so just thought Iā€™d check if the script youā€™re using still works for you. Also, I know you said you might do a plugin at some point. Is this still on teh cards? Thank you again.

1 Like

GitHub - eleanorkonik/concatenate: A plugin for Obsidian.md to allow you to put the contents of sections together in one file should work!

5 Likes

Thank you! Much appreciated.

Eleanor, thanks for sharing your expertise!

Iā€™ve implemented this snippets to link todayā€™s note to yesterday and tomorrow, it works well when linking to an already created note, for how I use these links typically this is the ā€œyesterdayā€ note. However when I click on ā€œtomorrowā€ hence creating the new note, this doesnā€™t come with the expected template associated for daily note.

I have had this issue for so long that I now feel motivated to solve it :slight_smile: hope you can share some directions! thanks :pray:

1 Like

If youā€™re using either the core Daily Notes plugin, or the Periodic Notes plugin, you can map hotkeys to ā€œOpen daily noteā€, ā€œOpen previous daily noteā€, and ā€œOpen next daily noteā€:

Using this command/hotkey will skip days you donā€™t have notes for. I donā€™t often write on weekends, so this is much more preferable to me than constantly updating broken links.

1 Like

I was referring to this snippet not working for uncreated note

ā† [[{{date-1d:YYYYMMDD}}]] [[{{date+1d:YYYYMMDD}}]] ā†’

My bad. I read too fast and thought that you did not want to see the notes that were not created. AFAIK the only way to automatically use a template is with the Daily note or Zettelkasten plugin.
Some time ago there was lots of talk around a way to add a specific template to any new note, but if a plugin was ever developed, I donā€™t know of it.

Last thought, although itā€™s still a workaround - the calendar plugin, coupled with periodic notes, allows for a designated template to be used when clicking on a specific day. The nice thing is that the date parsing is done as if you were adding the note on the day you clicked, so things like your snippet would still work in the way youā€™d expect without modifying them manually.

---
<%*
const title = tp.file.title;
const yesterday = moment(title).subtract(1, 'days').format("YYYY-MM-DD");
const today = moment(title).format("YYYY-MM-DD");
const tomorrow = moment(title).add(1, 'days').format("YYYY-MM-DD");
-%>
---
# [[<% yesterday %>|ā†]] <% today %> [[<% tomorrow %>|ā†’]]

This works with stuff like the Review plugin, Iā€™m not sure if itā€™ll do exactly what you want, but it should get you closer.

3 Likes

no worries, it give me a chance to explain myself better, in fact Iā€™m really confused about whatā€™s happening.

Iā€™m familiar with what you wrote in the last paragraph, the issue Iā€™m pointing at is related to this, when I click on tomorrow (before having created the new note from the calendar), ā€œtomorrowā€ note is created without the correct template. However, if I create the note from the calendar and then go back to ā€œtodayā€'s note and click on ā€œtomorrowā€ everything work as expected. Iā€™m starting to realise that this is a standard behaviour, since in the first scenario, Obsidian is receiving no instructions about what template to apply, whereas in the 2nd yes, through the plugin settings. Any thoughts?

Yes, you have things correct.
Creating a note from a plugin can trigger a template, but clicking a link, CTRL+N, or using the ā€œCreate a new noteā€ button will not.

Iā€™m pretty sure the Templater plugin has a setting to do this, but Iā€™ve never tried it. Try this setting:

Note that this is not just daily notes, but all new files. I thought sure someone had a plugin that could pick a template based on the fileā€™s folder location, but Iā€™m not seeing it.

Good luck!

1 Like

Hi,
Does that work on mobile?
When I insert your code in my daily note template I dont get your resultā€¦ are there any special templater configs necessary?
Thanks in advance!

templater does have that option. Look at the Folder Templates setting of the templater plugin

1 Like

Thank you! This looks great and works perfectly.