I have 366 HTML/Markdown journal prompts, that are organized by date (e.g., 1 January, 2 January— no year given, its in perennial calendar form so that the journal prompts can be used forever).
What I’m trying to do
I’d like to digitize them in my vault and have them (if possible) on the date given, initiate upon start-up in a template or templater form.
Things I have tried
Now without making 366 individual templates, and recalling them on each date, that is where my knowledge base ends unfortunately. I’ve searched Reddit and these forums, but I am unsure if I am wording my query correctly or if what I am searching for is clear or not.
I have been successful in learning what I need to learn when it comes to Obsidian, so I don’t think anything is out of my skill set as long as there are copious instructions.
If there is a solution already discovered by a past thread, please let me know, I don’t want to reinvent the wheel, just point me to it. Thank you!
I don’t have a complete solution for you, but I can share how I currently use my daily notes to provide a prompt for my Journal Du Jour, i.e. one prompt for each day of the calendar month. So it’s a similar use case, only scaled down to the month instead of the year. My solution is far from perfect but it works and might at least get you started or point you in a direction.
Here’s the snippet I have in my daily note so that each daily note depending on the calendar day
<%*
let dayOfMonth = tp.date.now("D");
let topic;
switch(dayOfMonth) {
case '1': topic = "> - 0| [[Authorities 📓]]"; break;
case '2': topic = "> - 0| [[House & Car 📓]]"; break;
case '3': topic = "> - 1| [[Apatheia 📓]]"; break;
case '4': topic = "> - 1| [[Contemplation 📓]]"; break;
case '5': topic = "> - 1| [[Topics Du Jour 📓]]"; break;
case '6': topic = "> - 1| [[Personal Knowledge Building 📓]]"; break;
case '7': topic = "> - 1| [[Self-Mastery 📓]]"; break;
case '8': topic = "> - 2| [[Physical Fitness 📓]]"; break;
case '9': topic = "> - 2| [[Vitality 📓]]"; break;
case '10': topic = "> - 2| [[Nutrition 📓]]"; break;
case '11': topic = "> - 2| [[The Flesh 📓|The Flesh (Habits & Routines)]]"; break;
case '12': topic = "> - 3| [[Feel-Good Marriage 📓]]"; break;
case '13': topic = "> - 3| [[Parenthood 📓]]"; break;
case '14': topic = "> - 3| [[Family 📓]]"; break;
case '15': topic = "> - 3| [[My Top 5 📓]]"; break;
case '16': topic = "> - 3| [[Karma 📓]]"; break;
case '17': topic = "> - 4| [[Software Engineering 📓]]"; break;
case '18': topic = "> - 4| [[Craftsmanship 📓]]"; break;
case '19': topic = "> - 4| [[Personal Performance 📓]]"; break;
case '20': topic = "> - 4| [[Finances 📓]]"; break;
case '21': topic = "> - 4| [[Writing 📓]]"; break;
case '22': topic = "> - 5| [[Fun 📓]]"; break;
case '23': topic = "> - 5| [[Music 📓]]"; break;
case '24': topic = "> - 5| [[Travel 📓]]"; break;
case '25': topic = "> - 5| [[Imagination 📓]] (Stories, TV)"; break;
case '26': topic = "> - 6| [[Productiveness 📓]]"; break;
case '27': topic = "> - 6| [[Self Actualization 📓]]"; break;
case '28': topic = "> - 6| [[Character Development 📓]]"; break;
case '29': topic = "> - 6| [[Personal Science 📓]]"; break;
case '30': topic = "> - raw: [[Kaizen 📓]]"; break;
default: topic = "> break";
}
tR += topic;
%>
You probably don’t want to follow this exactly, as then you would have to have 365 lines in your daily note template. You could research or dig further into how you could extract these lines into a separate file to load it from.
So in essence you want to copy some template into the current daily note based upon the day of the year. Then you need to store these templates somewhere.
Some alternatives on how to store these templates:
Pure javascript dicitionaries
Markdown lists with fields
Dedicated files
Using javascript
```dataviewjs
const dayOfYear = {
"Jan 1" : "A new year has started",
// ...
"Oct 17" : "The glorious day of October 17th",
"Oct 18" : "A not so glorious day?!",
//...
"Dec 31" : "A new year is about to happen..."
}
const today = (new DateTime("today")).toFormat("LLL d")
dv.span(dayOfYear[today])
```
This approach can be adapted into using Templater’s javascript code blocks, and thusly insert random template strings. But it’s easiest done for shorter amount of texts.
Using lists in another file
Another similar option could be to have lists like the following:
- ...
- [date:: "Oct 17"] [template:: "Your template text for October 17th"]
- [date:: "Oct 17"] [template:: "Your template text for October 18th"]
- ...
Has the same kind of limitations as presenting it directly in javascript that it’s best suited for shorter amount of text. Advantage here is that it can be viewed and queried within Obsidian in various ways, like using dataview
Using dedicated files
If you want larger texts, and possible other templating options I feel the better overall option is to use a dedicated folder with one template file for each day, and then if using Templater use tp.file.include() to include that file. Then any template code in the resulting file would also be executed/expanded upon.
In either case you can write a general template to include the day of the year template accordingly to how I select today in the javascript section. That way you’d end up with 367 “templates”, one which is used by the create the daily note, and 366 for each of the day of the year (including the leap year).
In most cases though, you’ll never think about the individual templates as the code to handle/choose those templates are generic and called from the main template.