Skip to content

Instantly share code, notes, and snippets.

@bennewton999
Last active April 25, 2024 12:40
Show Gist options
  • Star 94 You must be signed in to star a gist
  • Fork 8 You must be signed in to fork a gist
  • Save bennewton999/62b4a034445a24532591bc4c55a52cf5 to your computer and use it in GitHub Desktop.
Save bennewton999/62b4a034445a24532591bc4c55a52cf5 to your computer and use it in GitHub Desktop.
My current Daily Note Template in Obsidian utilizing Templater and DataView Plugins
---
creation date: <% tp.file.creation_date() %>
tags: DailyNote <% tp.file.title.split('-')[0] %>
---
modification date: <%+ tp.file.last_modified_date("dddd Do MMMM YYYY HH:mm:ss") %> // This doesn't currently work in front matter, hoping that gets fixed.
# <% tp.file.title %>
<< [[<% tp.date.now("YYYY-MM-DD", -1, tp.file.title, "YYYY-MM-DD") %>]] | [[<% tp.date.now("YYYY-MM-DD", 1, tp.file.title, "YYYY-MM-DD") %>]]>>
## Tasks
#### Over Due
```tasks
not done
due before <% tp.date.now("YYYY-MM-DD") %>
```
#### Due Today
```tasks
not done
due on <% tp.date.now("YYYY-MM-DD") %>
```
#### New Today
- [ ]
## Meeting Log
### 0000:
## Daily Log
### [[Project 1]]
### [[Project 2]]
### [[Project 3]]
## Daily Check List
### Start of Day
- [ ] Check Email
- [ ] Check Teams
- [ ] Check showing online
- [ ] Check Calendar - Time Block
### End of Day
- [ ] Show Offline
- [ ] Clean Unused Headings in Daily Log
- [ ] Check tomorrow's calendar
## Other Tasks
#### No Due Date
```tasks
not done
no due date
```
#### Done Today
```tasks
done on <% tp.date.now("YYYY-MM-DD") %>
```
@thomassajot
Copy link

Sorry, I noticed this #tasks that you can use to mark tick boxes as trackable for the Tasks Plugin.

@bennewton999
Copy link
Author

@thomassajot - hey glad you found this template interesting. I've modified how I handle my tasks since I wrote this. I really need to update the daily template article as I've changed a lot of what I'm doing.

Take a look here for how I'm handling the tasks. https://medium.com/geekculture/how-i-track-my-tasks-in-obsidian-47fd7ad80364

@fritaz
Copy link

fritaz commented Oct 30, 2021

Hey, forgive me if this is a dumb question because I'm completely new to this. I am trying to set up the daily notes and I'm not sure if I'm missing a plugin.

This is what I see when hovering over the file name in preview mode:

"<%+ tp.date.now("YYYY-MM-DD", 1, tp.file.title, "YYYY-MM-DD") %>" is not created yet. click to create.

then when clicked to create I see:

File name cannot contain any of the following characters * " \ / < > : | ?
Templaters question
file name cannot contain

@bennewton999
Copy link
Author

You need the Templater plugin, but it looks like you have that installed since the dates are showing. That's odd, I cannot reproduce that.

Here is the original article that explains everything related to this template - https://benenewton.medium.com/my-obsidian-daily-note-template-a4bdab53dc62

@fritaz
Copy link

fritaz commented Oct 31, 2021

Could it be because I'm running windows 11?

@bennewton999
Copy link
Author

I don't know if that's the reason you are seeing issues. I haven't heard of anyone having issues with this in Windows and the Templater plugin should work there. What I find odd is in your screenshot, the dates rendered, but the links are still to the template syntax. That is the same syntax for the name and the link, so why it renders but is not recognized by Obsidian is odd. Plus I see it's not working in your metadata. Make sure you have the latest updates installed for Obsidian and the plugins. Sorry, I don't have any ideas as to what is going on. Perhaps someone running windows can chime in.

@dabeshouse
Copy link

There is a switch under the Plugin Options for Templater: "Trigger Templater on new file creation".

It was turned off when I first installed Templater. Turning it on fixed this problem for me (on a Mac, so it is not just a Windows issue).

@ceciliamay
Copy link

Hey folks! I found a way to add dynamic commands like said modified date to the YAML with Templater. You have to enclose the command in specifically single quotes for it to work. Doesn't work with double q's. i.e:

---
aliases:
- 
tags: [" "]
created: 2021-12-01
modified: '<%+ tp.file.last_modified_date() %>'
---

will show up as:
image

The command works as expected. Dynamic. I do not know if there are problems and such with this method, as I only use it just as it is. Nonetheless, I hope this helps! CC @mattgrieser @bennewton999 @jroachgit

@bennewton999
Copy link
Author

Thanks @ceciliamay - This still doesn't work for me. It's not working outside of the front matter either now. I've even tried the code right from templater's docs. Not sure what's going on. But if it's working for you then great. I'm no longer worrying about the modified date, I haven't needed it yet. 😄

@yangwao
Copy link

yangwao commented Dec 26, 2021

Hey I've found your article @bennewton999 and was thinking for while doing really the same, I was aware of dataview plugin but not tasks tbh! My ideation was that at some day I produce more thoughts, but my execution is on average 1, like (100 Units of execution effort) and willpower 1 (each tasks can variously reduce my willpower a lot). Thus I noting at least stuff and than retro spectively picking up stuff I didn't finish.

This is my current template and was thinking to create one especially focused on backlogging stuff and would like probably add labels with p1-p5 like in GH tho so I can orient and probably put for myself "rewards" on it, where I see probably better impact ~

---
creation date: <% tp.file.creation_date() %>
modification date: <% tp.file.creation_date("dddd Do MMMM YYYY HH:mm:ss") %>
---

<< [[<% tp.date.now("YYYY-MM-DD", -1) %>]] | [[<% tp.date.now("YYYY-MM-DD", 1) %>]] >>

# <% tp.file.title %>

## My mental state
- 

## How we will make [[meta-prime]] better today?
- 

##### What is blocking me?
- 

##### What is going through your brain, to do?
- 

## How we will improve [[kodadot-vision]] today?
- 

##### What is blocking me?
- 

##### Routine tasks
- [ ] [review pull requests](https://github.com/kodadot/nft-gallery/pulls)
- [ ] [review issues](https://github.com/kodadot/nft-gallery/issues/)
- [ ] 5 minutes task, DMs, reply, RT & Discord

##### How we will grow and make better community today?
- 

@brimwats1
Copy link

Might be worth noting that tp.date.yesterday exists, much cleaner than your current :)

**← y'day:** [[<%tp.date.yesterday()%>]] | [[<%tp.date.tomorrow()%>]] **to'mor →** 

@bennewton999
Copy link
Author

@brimwats - I initially used those or something similar - but that will only work if you create the note on the same day. If you are creating notes on different days, you'll want the file name to be used as the base date for the links.

@brimwats1
Copy link

@bennewton999 that's an excellent point. I don't know if IOS has something similar, but Android's Macrodroid or Automate automatically creates a new daily note for me every morning at 2AM, and it's open when I wake up, so I haven't run into that problem yet. thanks for explaining!

@bennewton999
Copy link
Author

bennewton999 commented Jan 3, 2022 via email

@kmf
Copy link

kmf commented Jan 6, 2022

@brimwats you can do that with an Automation and iOS Shortcuts, I have one that runs at 5:00 every morning

@kennygokh
Copy link

When I clicked the previous day or next day link, it created a new file with the script name instead of pointing to daily note file I have created previous day. Any advise what went wrong? Script below. Screenshot attached on the file created.

<%+ tp.file.title %>

<< [[<%+ tp.date.now("YYYYMMDD ddd", -1, tp.file.title, "YYYYMMDD ddd") %>]] | [[<%+ tp.date.now("YYYYMMDD ddd", 1, tp.file.title, "YYYYMMDD ddd") %>]]>>

image

image

@bennewton999
Copy link
Author

Try removing the "+". I tried your code snippet, and after removing them, it worked.

<< [[<% tp.date.now("YYYYMMDD ddd", -1, tp.file.title, "YYYYMMDD ddd") %>]] | [[<% tp.date.now("YYYYMMDD ddd", 1, tp.file.title, "YYYYMMDD ddd") %>]]>>

@kennygokh
Copy link

kennygokh commented Jan 7, 2022

Thanks for your advice. After removing "+", in preview mode, it displayed the script. Hence, when you clicked the link, it came to the same problem as mentioned earlier.

image

@bennewton999
Copy link
Author

Hmm, the code I shared is cut and pasted right from a working template. It's odd that the title is being updated by Templater, but the links are not. Silly question, you are updating the template and not the note itself, correct?

@kennygokh
Copy link

kennygokh commented Jan 8, 2022

Not sure either. I am updating in notes, not in template. I tried both updating. Same problems. :-(

@bennewton999
Copy link
Author

You have to update the template, the process the template in a note. Cutting and pasting the Templater code directly into the note is just considered text. That is why it’s not working.

@kennygokh
Copy link

Thanks @bennewton999. I have updated the templates as advised. However, my mistake was that I didn't use the Open Daily command to create daily note. Instead, I was manually creating the note and insert the daily note template. It is now working correctly. Thanks :-)

@Broodje-met-Beleg
Copy link

Is there a way to get these codes in other languages?
Now all my notes show the date in English, but I'd like them to be in Dutch.

@svonjoi
Copy link

svonjoi commented Jan 28, 2022

@Broodje-met-Beleg use default YYYY-mm-dd format so u always have option to order your stuff by date

@aCyberVoid
Copy link

Hello! I just finished reading this whole thread and reviewed how you use the task plugin, but I still can not get Other tasks from duplicating what I have, even when I set a date for everything to test. For example, I set Check Email to daily, and set a date for everything just to test, but it still shows under Other Tasks. How would I go about preventing this?

@paulowen
Copy link

paulowen commented Feb 2, 2022

@aCyberVoid I 'think' (I'm new to Obsidian and Ben's content) obsidian-tasks is picking up the tasks as defined in the template also, hence the duplicates. obsidian-tasks has a filter for Paths so I added a path does not include Templates to the block, where 'Templates' is the name of my subfolder, like:

```tasks
not done
no due date
path does not include Templates
```

I no longer have duplicates and nothing else appears broken, but perhaps there is a better way to solve this?

@edenhare
Copy link

Hi - found your article on Medium and decided I liked your template and I was going to start using it. I am using the daily note plugin with this template. Templater is installed. when I click on daily notes to create a new note, I get an "invalid reference date format". I am not sure where to start looking to correct this.

@bennewton999
Copy link
Author

@labrlearning - if you look at line 10, we are using the file name as the input for the dates for links to go forward and back a day. If you're not using the same format for your file names, you will have to update this line.

@itsmyfirstname
Copy link

itsmyfirstname commented Jul 26, 2022

Hi - found your article on Medium and decided I liked your template and I was going to start using it. I am using the daily note plugin with this template. Templater is installed. when I click on daily notes to create a new note, I get an "invalid reference date format". I am not sure where to start looking to correct this.

Actually had a heck of a time getting the top portion of the doc to template correctly. Adding + seemed to do the trick, also had to adjust whitespace:

---
creation date: <%+ tp.file.creation_date() %>
tags: DailyNote-<%+tp.file.title.split('-')[1]%>-<%+tp.file.title.split('-')[2]%>
---

modification date: <%+ tp.file.last_modified_date("dddd Do MMMM YYYY HH:mm:ss") %>

# <%+ tp.file.title %>

<< [[<%+ tp.date.now("YYYY-MM-DD", -1, tp.file.title, "YYYY-MM-DD") %>]] | [[<%+ tp.date.now("YYYY-MM-DD", 1, tp.file.title, "YYYY-MM-DD") %>]]>>

@volvetcode
Copy link

how to deal with tasks from daily template in no due?

@michael-gaudet
Copy link

michael-gaudet commented Nov 19, 2022

Thanks @itsmyfirstname i had the same problem, that fixed it perfectly.

The only issue I have with this now is when Obsidian creates the daily note, these template fields all show up as the literal string “NaN”. But if I create a note and add the template, it works as expected.

Not sure if this is an obsidian Mobile thing or what. I’ll have to try with a desktop client.

AB02C98D-0182-4E5A-8FC9-E66185EED69E

@fishnibble
Copy link

Thanks @itsmyfirstname i had the same problem, that fixed it perfectly.

The only issue I have with this now is when Obsidian creates the daily note, these template fields all show up as the literal string “NaN”. But if I create a note and add the template, it works as expected.

Not sure if this is an obsidian Mobile thing or what. I’ll have to try with a desktop client.

AB02C98D-0182-4E5A-8FC9-E66185EED69E

I was able to fix this by

  • Making a folder for templates
  • setting templates path in templater
  • Setting daily temple to nothing
  • Making new daily temple with ctr + p + open daily note
  • alt + e select the template

I did however have to add this dataview to make sure it did not pick up tasks i added into the template (using dataview.js)

dv.taskList(dv.pages() .file.where(f => f.name != "Daily Note") .tasks.where(t => !t.completed)) 

@replete
Copy link

replete commented Jan 15, 2023

Thanks for sharing this.

In case it helps anyone, I wrote a CSS snippet to slight reduce the frontmatter visible priority. There isn't a selector to target the whole frontmatter (no containing div) but its better than nothing:

.cm-s-obsidian span.cm-def{
    font-size:25%;
}
.cm-s-obsidian .cm-hmd-frontmatter {
    font-size:75%;
}
.cm-s-obsidian span.cm-meta {
  color: var(--text-faint);
  opacity:0.5
}

@eulralx
Copy link

eulralx commented Nov 27, 2023

Hi, good morning, at first thanks so much for sharing your template. I use it since a lot of time. In the last weeks I've not worked a lot with Obsidian. Today I would start use it again and the following Tasks collections doesn't work anymore:

  • Over due
  • Due today
  • Done today

I'm not sure what changed or what I've to do, to fix it.

Can you help me or give me a hint what I have to do to be able to use the task collections again?

Bildschirmfoto 2023-11-27 um 07 51 26
Bildschirmfoto 2023-11-27 um 07 51 12
Bildschirmfoto 2023-11-27 um 07 50 59
Bildschirmfoto 2023-11-27 um 07 50 50
Bildschirmfoto 2023-11-27 um 07 50 29
Bildschirmfoto 2023-11-27 um 07 50 21

@bennewton999
Copy link
Author

Sorry - this is something I am no longer using or keeping up to date.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment