Is there a way to pin daily note in the sidebar and automatically renew each day?

What I’m trying to do

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.

This is a similar problem: Permanent place for daily notes

This is my sidebar daily note, what I want is that if I click the icon it will automatically locate to today’s daily note and open within the sidebar. Many thanks guys!

1 Like

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.

If I understand you correctly, it’s already there in the Ribbon menu (which I assume you call “sidebar”) if the Daily Notes core plugin is enabled.

image

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:

  1. 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
  2. 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
  3. 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.

![[2023-09-27 Wednesday]]%%embed%%

```dataviewjs
// 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)
```
1 Like

Am I not mistaken in that this will only work for viewing the note, and not editing the note though? (I’ve bolded those parts of the quote)

My use case for something like this would be to have the daily note readily available for editing, while I’m using the other tabs for browsing/viewing for everything else. But YMMV.

You can just click the link to immediately edit it - all in the sidebar.

The issue with having to click first is because Obsidian doesn’t yet allow editing of embeds, but I see plenty of threads on that so I imagine that will happen in the future too.

I updated my post to say “every time that note is visible on your screen” rather than when you “view” it, to make it more clear.

1 Like

Thanks for elaborating, I noticed I was totally misunderstanding. I should’ve read the original post more carefully…

BTW I suspect I can implement this as a QuickAdd macro, I’ll give it a try…

Probably this QuickAdd script will do the job. I’m not completely sure if the auto-update works though, because it’s still 18:00 here in Japan :innocent:

You can set the reflesh interval (10 sec by default) from QuickAdd’s macro settings.

Limitation: it assumes you use Templater’s folder template to generate a daily note. If not, it will create an empty note at the beginning of a day.

How to run this script as a QuickAdd macro:

1 Like

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).

Yeah, I’m a relatively newbie in JavaScript or web-ish programming, so I don’t know what is the best approach to do this kind of stuff.
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.

    if (leaf.view.file != file) {
        await leaf.openFile(file, { active: false });
    }

If anyone knows more proper way, please let me know.

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.

Link to new version:

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.