What I’m trying to do
Recently I have been trying to build and incorporate some bullet journaling techniques into Obsidian. What I am trying to do is have my weekly notes start with a section for my habits that I want to complete during the week. In this section, there are two subsections, one for the habits I am trying to complete and a schedule for what day that week I am trying to complete the habit on.
The first subsection I want is a list of my habits with a checkbox for the number of times I plan on doing it that week (an example would be Exercise (twice weekly) would have two empty checkboxes, and Make Bed (4x weekly) would have 4 empty checkboxes). It should look something like this:
- Exercise:
- Make Bed:
The second one would be similar to a calandar where I can assign my habits listed above to a day of the week. Example I want to exercise on Tuesday and Friday and Make Bed Tuesday, Wednesday, Saturday, Sunday. Then then each day would display something like this
Where it gets complicated is that I want to have this update into my daily notes for the week. So the habits that are assigned to lets say Wednesday will appear when I create my daily note for Wednesday. It should look something like this and be clicakble
- Make Bed:
Once that habit is clicked and done, it should then go back to the weekly note and update the total weekly note list. Something like this:
- Exercise:
- Make Bed:
Things I have tried
I have been trying to look at YouTube videos and using ChatGPT to trouble shoot as well and sadly I have run myself in a rut. Here is the code for both that I have been using
Weekly Note Template
YAML START
tags: weeklyreviews
Goals:
Water: 1
Exercise: 1
Stretching: 1
Snacking: 1
Outside: 1
Teeth: 1
Shower: 1
Face: 1
Dishes: 1
Bed: 1
Clothes: 1
Sleep: 1
habits:
monday:
- Exercise
tuesday:
- Stretch
wednesday:
- Drink Water
thursday:
- Brush Teeth
friday:
- Clothes
saturday:
- Sleep
sunday:
- Go Outside
YAML END
Habits
Weekly Habit Goals
let habits = dv.current().Goals;
dv.list([
`**Water**: ${"- [ ] ".repeat(habits["Water"])}`,
`**Exercise**: ${"- [ ] ".repeat(habits["Exercise"])}`,
`**Stretching**: ${"- [ ] ".repeat(habits["Stretching"])}`,
`**Snacking**: ${"- [ ] ".repeat(habits["Snacking"])}`,
`**Outside**: ${"- [ ] ".repeat(habits["Outside"])}`,
`**Teeth**: ${"- [ ] ".repeat(habits["Teeth"])}`,
`**Shower**: ${"- [ ] ".repeat(habits["Shower"])}`,
`**Face**: ${"- [ ] ".repeat(habits["Face"])}`,
`**Dishes**: ${"- [ ] ".repeat(habits["Dishes"])}`,
`**Bed**: ${"- [ ] ".repeat(habits["Bed"])}`,
`**Clothes**: ${"- [ ] ".repeat(habits["Clothes"])}`,
`**Sleep**: ${"- [ ] ".repeat(habits["Sleep"])}`
]);
Habit Assignments for the Week
table habits.monday as "Monday",
habits.tuesday as "Tuesday",
habits.wednesday as "Wednesday",
habits.thursday as "Thursday",
habits.friday as "Friday",
habits.saturday as "Saturday",
habits.sunday as "Sunday"
from "Journal/Weekly"
where file.name = this.file.name
Daily Note Template
YAML START
tags: dailyreviews
day: {{date}}
week: “[[Week <% tp.date.weekday(‘gggg-[W]ww’, 0) %>]]”
dayOfWeek: <% tp.date.now(‘dddd’) %>
habits:
drinkWater: false
exercise: false
stretch: false
noSnacking: false
goOutside: false
brushTeeth: false
shower: false
washFace: false
dishes: false
bed: false
clothes: false
sleep: false
YAML END
Habits
// Get the dynamically generated week link from the current daily note’s frontmatter
const weeklyNoteLink = dv.current().week;
// Check if weeklyNoteLink is an object and convert it to a string if necessary
let weeklyNoteLinkString = "";
if (typeof weeklyNoteLink === "object" && weeklyNoteLink.path) {
weeklyNoteLinkString = weeklyNoteLink.path; // Extract the path property if week is treated as an object link
} else if (typeof weeklyNoteLink === "string") {
weeklyNoteLinkString = weeklyNoteLink; // Use the value directly if it's already a string
} else {
dv.paragraph("Error: The 'week' field in the daily note's YAML is either missing or not a string or object with path.");
}
// Check if we successfully extracted the string value for the weekly note link
dv.paragraph(`Final weeklyNoteLinkString value: ${weeklyNoteLinkString}`);
// Extract the file name of the weekly note without brackets (e.g., Week 2024-W40)
const weeklyNoteName = weeklyNoteLinkString.replace(/\[\[|\]\]/g, "");
// Print all pages in the `Journal/Weekly` folder to debug available notes using the correct path filter
let allWeeklyNotes = dv.pages().filter(p => p.file.path.startsWith("Journal/Weekly"));
dv.paragraph("All weekly notes found in Journal/Weekly:");
dv.list(allWeeklyNotes.map(note => note.file.path));
// Search for the weekly note in the Journal/Weekly folder using the path directly
let weeklyNote = dv.pages().find(p => p.file.path === `Journal/Weekly/${weeklyNoteName}.md`);
// Get the current day of the week from the daily note’s frontmatter
let currentDay = dv.current().dayOfWeek.toLowerCase();
// Display the debugging information
dv.paragraph(`Weekly Note: ${weeklyNote ? weeklyNote.file.name : "Not Found"}`);
dv.paragraph(`Day of the Week: ${currentDay}`);
// Display the habits assigned for today, if found
if (weeklyNote && weeklyNote.habits && weeklyNote.habits[currentDay]) {
dv.list(weeklyNote.habits[currentDay]);
} else {
dv.paragraph("No habits found for today.");
}