Using the Templater plugin, you can easily get the day of the week from a dynamic execution context, so something like the following would print “Hooray” on days like the day I wrote this.
<%* const dayOfWeek = moment().weekday(); console.log( "m", dayOfWeek) -%>
Humpty, dumpty, some other text
%%before%%
<%* if ( dayOfWeek == 1 ) { -%>
Too early?
<%* } else if ( dayOfWeek == 2 ) { -%>
Hooray
<%* } else { -%>
not so good
<%* } -%>
%%after%%
Some explanations are in order:
- When using dynamic execution code,
<%*, it allows for javascript execution of code - The
moment().weekday()returns the day of the week as number, which allows us to check on that later on, so store that indayOfWeek - This can be going back and forth between ordinary text, which can be a little confusing, but you’ll get the drift of it
- Using
-%>to end the template blocks, re-assures that the this template block does not add a newline into the created note - The
%%before%%and%%after%%doesn’t serve any purpose beside helping to see the newlines. Feel free to remove them after you played around a little with either%>or-%>to end the template blocks