Dynamically create a backlink to a file?

Hello. I have an excellent Daily Note template that I’ve developed for my needs (I plan to share on the forum once I figure this next question out). I would like to add a ‘[[yesterday]]’ and ‘[[tomorrow]]’ link on each daily note.

Is there a way to automatically have the ‘yesterday’ backlink to yesterday’s daily note, and conversely, the ‘tomorrow’ one, once created?

My file nomenclature is: YYYYMMDDhhii_daily_note.md

I use TextExpander for my template creation and have been working with someone there in tech support, but they’re uncertain how to do that with their app. I’ve seen a video where someone did that with a shell script (which I don’t know how to write) and Keyboard Maestro, but they didn’t explain how to do it.

Any thoughts?

1 Like

@mitzimbj posted his way of doing it in Fun with espanso but has the title says, he does it with espanso.
I’m not familiar with Keyboard Maestro so can’t help you with that, I hope that the above helps you in some way.

So you’re okay with using text expansion to accomplish the goal? It should be trivial as long as you don’t mind that—I can try drafting up a KM macro for you.

Thank you, @Meins. I actually saw that post and tried to recreate it using TextExpander (I don’t use Keyboard Maestro, that was from a video I saw). Thanks again.

@ryanjamurphy That’s very kind of you. I actually don’t use KM. Sorry I was unclear in my post. I meant that I saw that in a video. I use TextExpander by Smile.

Ah, then I’m of less help.

What does hhii translate to again?

I would think it should be easy to generate the text you want using Text Expander.

See the documentation, especially the legacy date format section:

If hhii refers to hour and minute, I would remove that from your filename. Then, you should be able to generate yesterday and tomorrow’s date easily using Text Expander’s date/time math. Specify the date using your filename syntax, surround each in [[]], and you should be good to go.

Sorry for my delayed reply @ryanjamurphy. Yes, I’m able to easily automate the creation of the link, and it makes sense that I should use the hhii in order. I’ll give the instructions you provided a shot. Thanks again.