Skip to content

foam daily

Show or create the daily note for a date.

foam daily [options]

Without --create, the command only reports whether the note exists. With --create, it writes the note if it doesn’t exist yet, using your daily note template if one is configured.

OptionDescription
--date <YYYY-MM-DD>Date to target (default: today)
--createCreate the note if it doesn’t exist
--path-onlyPrint only the resolved file path (useful for scripting)
--trustRun a JavaScript daily note template (daily-note.js)
--workspace <dir>Workspace root (default: FOAM_WORKSPACE env var, then current directory)
--format <fmt>Output format: text (default) or json

Show today’s daily note status:

Terminal window
foam daily
# journal/2024-01-15.md [exists]

Create today’s daily note:

Terminal window
foam daily --create

Get the path to a specific date’s note (for scripting):

/home/user/notes/journal/2024-01-10.md
foam daily --date 2024-01-10 --path-only

Open today’s note in your editor:

Terminal window
$EDITOR $(foam daily --create --path-only)

If your daily note template (.foam/templates/daily-note.md or .foam/templates/daily-note.js) sets a file path, the note goes there. Otherwise the deprecated foam.openDailyNote.* settings in .vscode/settings.json decide, and without them notes go to journal/YYYY-MM-DD.md — the same place VS Code puts them. The template, when there is one, always provides the content.

The path must stay inside the workspace, even through symlinks: otherwise foam daily --create stops with an error telling you to check the template’s file path and the foam.openDailyNote.directory setting.

See Note Templates for how to configure daily note templates.

A JavaScript template runs code on your computer, so when your workspace has .foam/templates/daily-note.js, foam daily stops with an error unless you add --trust:

Terminal window
foam daily --create --trust

Only add --trust if you wrote the template yourself, or trust whoever did.

Published with Foam