Skip to content

Instantly share code, notes, and snippets.

@dannberg
Last active May 1, 2024 12:56
Show Gist options
  • Save dannberg/48ea2ba3fc0abdf3f219c6ad8bc78eb6 to your computer and use it in GitHub Desktop.
Save dannberg/48ea2ba3fc0abdf3f219c6ad8bc78eb6 to your computer and use it in GitHub Desktop.
Dann Berg's Daily Note Template for Obsidian. Uses Dataview & Templater plugins. Should be saved as a Markdown file in Obsidian. Read the full tour: https://dannb.org/blog/2022/obsidian-daily-note-template/
---
created: <% tp.file.creation_date() %>
---
tags:: [[+Daily Notes]]
# <% moment(tp.file.title,'YYYY-MM-DD').format("dddd, MMMM DD, YYYY") %>
<< [[Timestamps/<% tp.date.now("YYYY", -1) %>/<% tp.date.now("MM-MMMM", -1) %>/<% tp.date.now("YYYY-MM-DD-dddd", -1) %>|Yesterday]] | [[Timestamps/<% tp.date.now("YYYY", 1) %>/<% tp.date.now("MM-MMMM", 1) %>/<% tp.date.now("YYYY-MM-DD-dddd", 1) %>|Tomorrow]] >>
---
### 📅 Daily Questions
##### 🌜 Last night, after work, I...
-
##### 🙌 One thing I'm excited about right now is...
-
##### 🚀 One+ thing I plan to accomplish today is...
- [ ]
##### 👎 One thing I'm struggling with today is...
-
---
# 📝 Notes
- <% tp.file.cursor() %>
---
### Notes created today
```dataview
List FROM "" WHERE file.cday = date("<%tp.date.now("YYYY-MM-DD")%>") SORT file.ctime asc
```
### Notes last touched today
```dataview
List FROM "" WHERE file.mday = date("<%tp.date.now("YYYY-MM-DD")%>") SORT file.mtime asc
```
@Gryn23
Copy link

Gryn23 commented Mar 6, 2024

This is the template for my weekly note. Of course you need to change the names of the folder, and translate "Volgende week" with 'next week'.

`##### <% moment(tp.file.title, 'YYYY-[W]-WW').format("[Week] ww - DD MMMM YYYY") %>

<< [[<% fileDate = moment(tp.file.title, 'YYYY-[W]-WW').subtract(1, 'w').format('[To_do/Week]/YYYY/MM-MMMM/YYYY-[W]-WW') %>|Vorige week]] | [[<% fileDate = moment(tp.file.title, 'YYYY-[W]-WW').add(1, 'w').format('[To_do/Week]/YYYY/MM-MMMM/YYYY-[W]-WW') %>|Volgende week]] >>`

@Gryn23
Copy link

Gryn23 commented Mar 6, 2024

My properties are in the template too. I've hidden properties after I made sure they work. Unhidden this is what shows in the template:

afbeelding

And this is what's spit out if I make a weekly note, (but only if you do so in the right folder! Select the right folder, click right and choose new note, or click "volgende week" on an existing note. Making weeknumbers visible in Calender and clicking an empty weeknumber (or day) works as well.) As you see the "Update time on edit" plugin automatically added date properties.

afbeelding

@pantsmasterson
Copy link

Am I the only person for whom this code just stays as pasted-in code when I start a new daily note?

Notes
<% tp.file.cursor() %>

It just stays in the note, like so:

image

@Gryn23
Copy link

Gryn23 commented Mar 21, 2024

@pantsmasterson you need to get rid of the quotation mark (') before and after the code. Or maybe you didn't install the templater plugin?

@pantsmasterson
Copy link

pantsmasterson commented Mar 21, 2024

I put the ticks in the comment so they'd appear as code in the Github comment -- they don't appear in the template itself. In the template, it is exactly as it appears in the screenshot, and renders as that piece of code rather than the cursor at that position (which I assume is what's supposed to happen). In the templater code, I've cut and pasted exactly what appears above. The Templater plugin is installed and active.

@Gryn23
Copy link

Gryn23 commented Mar 21, 2024

  • Did you tick "automatic jump to cursor" in Templator's options?
  • And maybe a stupid question, but you pasted '<% tp.file.cursor() %>' in your template, right? It's supposed to stay code in your template, and only when you 'create new note form template' it should give you a note without the code and just the cursor below your Notes heading.

@pantsmasterson
Copy link

Aha! It was automatic jump to cursor! Thank you so much -- I'd never have puzzled that through solo.

@Gryn23
Copy link

Gryn23 commented Mar 21, 2024

Haha, glad to help, I'm a beginner myself.

@dannberg
Copy link
Author

You're not the first person with a question about <% tp.file.cursor() %>. I should be explicit about this being a setting that needs to be enabled in the post. Will update!

@re3factor
Copy link

re3factor commented Mar 21, 2024

Anyone with a tip to stop odd formatting issue when trying to put in a block of code? Whenever I put in the code formatting ticks it opens code for everything below it, even after putting in the code in question and closing the formatting correctly?

image

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