I have recently started building a Digital Garden on Obsidian. I like the analogy of ideas being equal to seeds and then tending them until they grow into something bigger: ๐ฑ -> ๐ฟ -> ๐ณ
To imitate the growth phases automatically, I need to track when a file was created and how many times it has been edited.
I found a plugin on Obsidian (Update Time on Edit) that keeps track of the created date and modified date as a frontmatter. It however only keeps track of the last modified time.
I found another plugin that allows you to generate frontmatter for a file using Javascript: Obsidian Frontmatter Generator. I was able to tweak it to track file change dates.
So here is how I used the plugin to keep track of every edit I make to each file.
{
edits: (() => {
// Fetch list of edit dates. If not set yet, use empty array.
currentEdits = file.properties?.edits || []
// Clone the existing edit list into a new array. The plugin
// can't detect changes made to existing list.
result = [...currentEdits]
// Fetch today's date and get rid of timestamp
// I am only intersted in the date, not time.
today = new Date().toDateString()
// Insert the date in edit list if it's absent
length = currentEdits.length
if (length == 0 || currentEdits[length - 1] != today) {
result.push(today)
}
return result
})(),
}
And thatโs it. Any time you edit the file, the date should be appended to the frontmatter if itโs not on the list.
I track the file growth in my Digital Garden using this method. You can use it however you want.
Maybe I will try to wrap it up into a plugin as a pointless project?