CyanVoxel / Obsidian-Vault-Template

A Template for my Obsidian Vault.
MIT License
313 stars 49 forks source link

Suggestion to Simplify Daily Note Template #1

Closed steven-kraft closed 6 months ago

steven-kraft commented 6 months ago

Hi, I noticed in your daily note template you have a rather lengthy if statement for getting the day of the week in lowercase.

I think you could replace that with <% tp.date.now("dddd").toLowerCase() %>

Additionally, you should be able to get the date from the title of your daily note, rather than just the current date, by using the reference and reference_format arguments: <% tp.date.now("dddd", 0, tp.file.title, "YYYYMMDD").toLowerCase() %>

The templater docs might explain it better than I can.

CyanVoxel commented 6 months ago

I knew that the chain of "if-elses" was pretty bad, but I actually feel embarrassed that I never thought to just try a different method to get the formatted day like that... I guess I was still creating the CSS at the time, and didn't take a look at the bigger picture! I've also gone ahead and switched to referencing the date by filename instead of just grabbing the current date, so notes created retroactively for dates should apply the correct CSS class and subtitle.

I've pushed these changes to the main Daily Themes repo (https://github.com/CyanVoxel/Obsidian-Daily-Themes) and will propagate that newer version here!