Skip to content

Commit 2d69fb2

Browse files
committed
Add daily_notes.default_tags option
To customize or remove the default tags assigned to new daily notes.
1 parent 7e087da commit 2d69fb2

File tree

4 files changed

+6
-1
lines changed

4 files changed

+6
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1010
### Added
1111

1212
- Added relative to root markdown links as search pattern for backlinks.
13+
- Added configuration option `daily_notes.default_tags` for customizing (or removing) the default tags given to new daily notes.
1314

1415
### Fixed
1516

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,8 @@ This is a complete list of all of the options that can be passed to `require("ob
252252
date_format = "%Y-%m-%d",
253253
-- Optional, if you want to change the date format of the default alias of daily notes.
254254
alias_format = "%B %-d, %Y",
255+
-- Optional, default tags to add to each new daily note created.
256+
default_tags = { "daily-notes" },
255257
-- Optional, if you want to automatically insert a template from your template directory like 'daily.md'
256258
template = nil
257259
},

lua/obsidian/client.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1946,7 +1946,7 @@ Client._daily = function(self, datetime, opts)
19461946
if path:exists() then
19471947
note = Note.from_file(path, opts.load)
19481948
else
1949-
note = Note.new(id, {}, { "daily-notes" }, path)
1949+
note = Note.new(id, {}, self.opts.daily_notes.default_tags or {}, path)
19501950

19511951
if alias then
19521952
note:add_alias(alias)

lua/obsidian/config.lua

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,7 @@ end
361361
---@field date_format string|?
362362
---@field alias_format string|?
363363
---@field template string|?
364+
---@field default_tags string[]|?
364365
config.DailyNotesOpts = {}
365366

366367
--- Get defaults.
@@ -371,6 +372,7 @@ config.DailyNotesOpts.default = function()
371372
folder = nil,
372373
date_format = nil,
373374
alias_format = nil,
375+
default_tags = { "daily-notes" },
374376
}
375377
end
376378

0 commit comments

Comments
 (0)