Hi guys, is there a way I can pin my daily note in the side bar that will automatically renew each day? I find that daily note could be helpful if I can dock it in the side bar so that I can always reference to it without disrupting my workflow. But I haven’t found a way to do that yet.
Things I have tried
I tried using the plugin called commander, but it seems that there’s no sidebar option.
I’d like to be able to do the same with my monthly note (have it update each month,) but I realise it’s a lot less inconvenient for me to update it each month than it is for you to update each day. Still would be nice to have a feature or plugin for this sort of thing, and I’m sure a lot of people would benefit from it.
I’m more understanding it as they want to have a panel pinned which has the daily note displayed (and updated to the current day as days go by). And this panel should allow for the editing of that daily note.
I see three different solutions to this conundrum:
Build a plugin to produce that panel, which implements logic to update its source to be the current daily note automagically, whilst still allowing for changes be made to the daily note
Pin a “Daily note scratchpad” note to the panel, and make a command/template to keep track of days/date and at the push of a button save the current content to the corresponding daily note and reset the scratchpad
Make a command which exchanges a given daily note in the side panel with the daily note of the current day
Neither exists as of now, but I do believe the second alternative would be easiest to implement, and with the least side effects.
The third alternative would require manipulation of the pinned panel setup, which might easily change with version updates. The first would require more in-depth knowledge of building new panels and interfaces to the Obsidian API.
The second one though, would rely on existing functionality with some somewhat easy template code and a button or two.
I foresee a button on the top which needs to be pressed on a new day, and it’ll take everything off the scratchpad and store in a corresponding daily note to the date specified on the pad somehow, erase the content and set the date to the current date.
@Monohponic you can do it like this, which I suggested to someone who wanted to embed today’s note into a Canvas. You can drag the note into your sidebar and have it always update with today’s note:
If you put this code into a note (including the first line), every time that note is visible on your screen the Dataview code will execute and update the embed link to be the current date.
This also works fine from a canvas and automatically updates the embedded note just from viewing the canvas.
Note: You will need to update my date format YYYY-MM-DD dddd to match the one you’re using.
// The date format for your periodic/daily notes
const dateFormat = 'YYYY-MM-DD dddd'
// Get the current file
const file = app.vault.getAbstractFileByPath(dv.current().file.path)
// Get the text contents of the current file
let contents = await app.vault.read(file)
// Update any text on the line before %%embed%% to be an embedded link to today's note
contents = contents.replace(/^.*?%%embed%%$/m, '![[' + moment().format(dateFormat) + ']]%%embed%%')
// Save the new contents back to the current file
await app.vault.modify(file, contents)
I’ve not used QuickAdd like this to refresh the settings like this, but will this force the daily note to popup every 10 seconds?
And that refresh every 10 seconds throughout the entire day, will only actually do something at day shifts and when you open Obsidian anew? Not to be negative, but isn’t that loads of wasted processing time?
No, the updates will be done in the background, so the daily note will not popup automatically. You have to manually open the right sidebar and click the tab to see it (or just keep it open).
But the most expensive part (= opening the daily note in the tab) is only executed at day shifts because of this if statement, and it would be safe to say the cost for the rest part is negligible, I guess.
I’ve updated the script so that updates are done only at the beginning of the day. The problem is that, even if I accidentally go to a different file from the daily note in the sidebar, it will no longer automatically bring me back to the daily note.