Skip to content

Commit

Permalink
Fixed regression with updating frontmatter in templates
Browse files Browse the repository at this point in the history
Fixes #581.
  • Loading branch information
epwalsh committed May 16, 2024
1 parent 2e1f034 commit a9978d0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed

- Made workspace detection more robust.
- Fixed regression where frontmatter is updated in template files.

## [v3.7.12](https://github.com/epwalsh/obsidian.nvim/releases/tag/v3.7.12) - 2024-05-02

Expand Down
11 changes: 11 additions & 0 deletions lua/obsidian/client.lua
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,17 @@ end
---
---@return boolean
Client.should_save_frontmatter = function(self, note)
-- Check if the note is a template.
local templates_dir = self:templates_dir()
if templates_dir ~= nil then
templates_dir = templates_dir:resolve()
for _, parent in ipairs(note.path:parents()) do
if parent == templates_dir then
return false
end
end
end

if not note:should_save_frontmatter() then
return false
elseif type(self.opts.disable_frontmatter) == "boolean" then
Expand Down

0 comments on commit a9978d0

Please sign in to comment.