I use Obsidian to track my notes, what I do, what I think about, even at work. For the week, it’d be really nice to have a weekly summary of notes in Obsidian.md, but there’s not any out of the box way to do that.
I have written a dataviewJS pile of javascript that can do it, based on the creation time of a note. This works perfectly with a daily note, as it knows what context it’s in already, and is the typical starting place for my day.
// Load with dv.view("script.js"); //This is gonna use the luxon DateTime that comes with dataviewJS so I can assume types function getWeekDates(forDateTime) { const today = forDateTime; const dayOfWeek = today.weekday; const sundayDate = today.minus({ days: dayOfWeek % 7 }); // Subtract the current day of the week from today's date to find Sunday let weekDates = []; for (let i = 0; i < 7; i++) { let nextDay = sundayDate.plus({ days: i }); // Add i days to the Sunday date weekDates.push(nextDay); } return weekDates; } //Of note, luxon sees monday as 1, 1 indexed. const todaysNoteDate = dv.date(dv.current().file.cday); const weekDays = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']; const weekDates = getWeekDates(dv.date(todaysNoteDate)); for( let dayIndex in weekDays ) { let theDay = weekDays[dayIndex]; let theDate = weekDates[dayIndex]; let rows = dv.pages() .where(p => p.file.cday.hasSame(theDate, 'day') || p.file.mday.hasSame(theDate, 'day')) .map(p => [dv.fileLink(p.file.path), p.file.cday, p.file.mday]); if(rows.length != 0) { let mdt = dv.markdownTable([theDay + "'s Page", "Created", "Modified"], rows); dv.paragraph(mdt); } }
I chose to place mine in a _dvScripts
folder at the root of my vault. Works great, and gives me a beautiful list of touched notes with enough context to know whether I created it, or touched it this week.
Hopefully, this weekly summary of notes in Obsidian.md will help me keep my notes more organized, and help me keep up with all the things going on!