I'd like to link to my current weekly, quarteryly and yearly note on my home page

What I’m trying to do

I am trying to create dynamic links to my current weekly, quarterly and yearly note within my home page that I am formatting as a dashboard.

Things I have tried

I have experimented with Templater but cannot find the correct instructions on how to create this function and I am unsure of which language to use and how to write the code relevant to create this function.

You can do this with using inline commands:

`$= '[['+moment().format("YYYY-MM-DD")+'|Today]]'`  
`$= '[['+moment().format("MMMM YYYY [Woche] ww")+'|Week]]'`  
`$= '[['+moment().format("YYYY - MM-MMM")+'|Month]]'`

Formatting belongs to your naming of the daily / weekly / monthly notes. Inserting the example above to your homepage will create something like this:

image

Referring filenames in this case would be:

image

Note: this is a feature of DataView that must be explicitly turned on in settings (Enable Inline JavaScript Queries)

This is very helpful macmorri. From the inline code you shared I was able to make links to my current week and quarter on my daily note. See belowe

$= '[['+moment().format("YYYY-[W]W")+'|This Week]]'
$= '[['+moment().format("YYYY-[Q]Q")+'|This Quarter]]'

May I ask:
What do the functions $= and + do?
How can I create links to yesterday and tomorrow using inline code?

Thank you for the recommendation Siiraa. I will look into the button functionality at a later date. For now I want to understand dataview and how it works.

$= is not a function. It introduces a following dataview js inline statement. You can read about this inside dataview documentation: DQL, JS and Inlines - Dataview
+ is just a concat. For example following concat …

'Hello winking' + '***' + ' bye winking'

… will result in …

Hello winking*** bye winking

For another day (like yesterday or tomorrow) you could modify the moment call just like:

$= '[['+moment().add(-1, 'days').format("YYYY-MM-DD")+'|Yesterday]]'
$= '[['+moment().add(+1, 'days').format("YYYY-MM-DD")+'|Tomorrow]]'

As you can see you can just add / subtract days from “your moment”.

2 Likes

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