Linking to last created Daily Note

What I’m trying to do

I am using the Daily Notes plugin as a Task-Manager and as a Journal.
In the Top of my daily-Notes-template I’m linking to the daily note the day before. This way i can quickly cicle them through if i search something special or if I want to just read the journal chronologicaly.
The problem is, that I’m not writing my daily notes every day. That results in links to not existing daily notes.
For example I write a daily note on the first day a month. Then I skip to days and come back on the 4th day the month. Now the daily note from the 4th day links to a not existing daily note for the 3rd day.
Is there a way in Templater or something else where i can link to the last created daily note?

Current “Workaround”

Well actually there is no real workaround yet. I usaly just populate the missing days and and leave them as empty notes with just the links to the previous and next day. You can see how messy and unsatifactory this “solution” is right?.

Thanks in advance for any help or suggestion :slight_smile:

You can use cmd+P and type “daily” and then previous or next daily note - but the best bit about this is that you can set up hotkeys / shortcuts to these actions which makes it far quicker than having to select cmd+P each time. I also scroll through my previous / next dailies and this works fine for me. If there is a day missed it doesn’t matter, it simply goes to next date.

1 Like

How does that exactly work? When I open the “cmd+P”-Menu and type daily (or in my case heutige since I’m german) I just get the option to open the daily note from today.

Hmm… this is what I see. I’m no expert I’m afraid but hopefully someone else might be able to shed some light on this? (The screen shot above is actually from the mobile version, but it’s exactly the same as on the mac). There is indeed a way to do a previous / next clickable links via templater but it’s not something I’ve done.

1 Like

Thanks that already helped me.
Sadly the translation for the shortcuts concerning the daily notes plugin seems to be inconsistnet in German.
Now I see the “Open next daily note” (for me its “Nächste tägliche Notitz öffnen”)-button and also the “Open previous daily note” (for me it’s “Vorherige Tagesnotiz öffnen”).

Thanks a lot :slight_smile: , so far that feature is realy helpful and fast. However I would still like it to have a link in the top of my daily notes that takes me to the previous and next daily note.

Brilliant - I’m glad that’s worked at least :D. Yes, i think to get the “proper” previous / next options you need to use templater. Might be worth searching in the forum for this - I’m sure it has probably been asked about in the past?

I already took a quick glance and was’nt able to find what I search. But I’ll investigate furthor.

Here’s the link to the official templater documentation. Actually, this example on this page is actually what you’re trying to do! It might help? IT’s all a bit complex for me atm!

Yea thats exactly what I currently use. However the <% tp.date.now(“YYYY-MM-DD”, -1) %> Command scans the current date and then goes one day before. But that will always just link me to the previous day.

But thanks for your effort in looking around :slight_smile:

1 Like

Another way to do this might be to use the Buttons plugin. It allows you to create a button (and style it) and upon clicking the button, one of the many things you can do is run any command available in the Command Palette (CMD+P). You could setup a button for previous day’s entry like this for example,

```button
name Previous
type command
action Open previous daily note
2 Likes

Love it!
Exactly what I was searching for and better.
Now the only drawback, or better not optimal thing, is that the two Buttons are under each other.
Do you know a way to put them next to each other? Then I could click on the left Button to get to the previous note and on the tight to get to the next.

I’ll do you one better! If we assign an id to a button, we can reuse that in multiple notes so you don’t need to define it in every note. So in one note, define the buttons as before but add an id at the bottom (after the three ticks)

```button
name < Previous
type command
action Open previous daily note
three-ticks-cannot show here
^button-prev

The way it should look is,

Then in your daily notes, put this inline button which shows side by side and this refers to the buttons we created above,

`button-prev` `button-next`

That should give you this,

image

You can further style these using CSS snippets if you like.

1 Like

The date for the day before is calculated the first time the template is executed. If you create the daily note each day, it won’t fail and the links to previous and following days will be ok.

If you need to create a note for a future/past day, there is a reply to a post that may help you. It uses the Daily notes and Calendar plugins.

  1. Define your daily note template using these variables: {{yesterday}} and {{tomorrow}}
    # {{date}}
    
    [[{{yesterday}}|< {{yesterday}}]] | [[{{tomorrow}}|{{tomorrow}} >]]
    
  2. Create a daily note from the calendar (e.g. clicking on the 23rd of June)
    # 2021-06-23
    
    [[2021-06-22|< 2021-06-22]] | [[2021-06-24|2021-06-24 >]]
    

Result in preview

NOTE: If you need something more specific than that and you have some JS knowledge you may be able to define a Templater Script User Function to satisfy your needs passing the tp.file.title as an argument to get the date for the previous/next day.

2 Likes

Wow thank you thats just what I needed.
I’m very thankful for all the effort you made. Thanks a lot :slight_smile:

1 Like

Thank you for your response.

The problem is that I do not create a daily note every day. The other post you reposted seems helpful at a first glance. Not sure if there is the proper solution for an automated template.

However I realy like the solution provided by @Rishi so no further effort needed.

Thanks a lot again :slight_smile:

Maybe you could also be interested in REAL Daily Notes previous/next navigation. This uses Dataview and handles gaps.

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