Skip to content

fix: fill template variables in daily notes - #144

Open
jayhemnani9910 wants to merge 1 commit into
Yakitrak:mainfrom
jayhemnani9910:fix/daily-template-variables
Open

jayhemnani9910 wants to merge 1 commit into
Yakitrak:mainfrom
jayhemnani9910:fix/daily-template-variables

Conversation

@jayhemnani9910

Copy link
Copy Markdown

Description

daily copies the daily-note template as it is, so {{date}}, {{title}} and {{time}} stay literal in every note it creates:

# .obsidian/daily-notes.json: {"folder":"Journal/Daily","format":"YYYY/MM/YYYY-MM-DD ddd","template":"Templates/daily"}
# Templates/daily.md:
#   created: {{date:YYYY-MM-DD}} {{time}}
#   # {{title}}
notesmd-cli daily
# before: "created: {{date:YYYY-MM-DD}} {{time}}" / "# {{title}}"
# after:  "created: 2026-11-15 19:19"           / "# 2026-11-15 Sun"

The template is now filled in the way Obsidian's daily notes plugin does it: {{date}} and {{title}} are the note name, {{time}} is HH:mm, and {{date:FORMAT}} / {{time:FORMAT}} take a Moment.js format (through the existing MomentToGoFormat).

Motivation and Context

Before #90, daily opened obsidian://daily and Obsidian filled the variables. Since daily writes the file itself, a template with a date heading or a {{date}} property gives a note with placeholders, and tools that read the property (Dataview, Properties) get the literal text.

Checklist:

  • I have written unit tests for my changes.
  • I have updated the documentation accordingly.
  • All new and existing tests passed.

Added "Fills template variables" to TestDailyNote; it fails without the change. go test ./... passes. Ran the steps above with a built binary on a scratch vault.

Since daily writes the note itself (Yakitrak#90), the template was copied as is, so {{date}}, {{title}} and {{time}} stayed literal. Fill them the way Obsidian's daily notes plugin does: {{date}} and {{title}} are the note name, {{time}} is HH:mm, and {{date:FORMAT}}/{{time:FORMAT}} take a Moment.js format.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant