Ever been in a standup, someone asks what you worked on yesterday, and you find yourself frantically scrolling through notes? Been there! After one too many “um, let me check” moments, I built a smarter solution using Obsidian templates.
The Problem
As developers, we’re constantly context-switching between tasks and projects. Keeping track of what we worked on shouldn’t be another task on our plate. Yet there I was, repeatedly:
- Scrolling through notes during standups
- Trying to remember what I did last Friday during Monday’s meeting
- Juggling between desktop for work and iPad for meetings
- Manually linking between daily notes (and often forgetting)
The Solution: Smart Templates
I built a template that automatically finds and links your previous work items. But here’s where it gets interesting - it doesn’t just grab yesterday’s notes. It keeps looking back until it finds the last day you actually did some work, ignores empty work logs, and has a safety limit to prevent infinite loops.
The Code
Here’s the core template that makes it all work:
# Today's Notes
# Work
# <%*
const currentNoteDate = moment(tp.file.title.split('-').slice(0,3).join('-'), 'YYYY-MM-DD');
let checkDate = currentNoteDate.clone().subtract(1, 'days');
let fileFound = false;
const maxDaysToLook = 14;
let daysChecked = 0;
while (!fileFound && daysChecked < maxDaysToLook) {
const fileName = `${checkDate.format('YYYY-MM-DD')}-${checkDate.format('dddd')}`;
const filePath = `${fileName}.md`; // Add your folder path here
const exists = await tp.file.exists(filePath);
if (exists) {
const content = await app.vault.adapter.read(filePath);
const workSection = content.match(/# Work\n([\s\S]*?)(?=\n#|$)/);
if (workSection && workSection[1].trim().length > 0) {
fileFound = true;
tR += `Previous Work Items (${checkDate.format('dddd')})`;
%>
![[<%*
tR += `${fileName}#Work`;
%>]]
<%*
break;
}
}
checkDate.subtract(1, 'days');
daysChecked++;
}
if (!fileFound) {
tR += "Previous Work Items (None Found)";
}
%>
# Personal
## Projects
### Progress Update
How It Works
The template uses a few clever tricks to make your life easier:
Smart Date Handling
Instead of just grabbing yesterday’s notes, it keeps looking back until it finds a note with actual content. Had a day full of meetings with no notes? It’ll skip it. Coming back after a weekend? It’ll find Friday’s notes.
Content Validation
This is where it gets smart. Instead of just checking if a note exists, it looks for actual content in the Work section. No more links to empty notes!
const workSection = content.match(/# Work\n([\s\S]*?)(?=\n#|$)/);
if (workSection && workSection[1].trim().length > 0) {
fileFound = true;
// ...
}
Safety First
A built-in limit prevents any infinite loops if something goes wrong:
const maxDaysToLook = 14; // Safety limit
let daysChecked = 0;
while (!fileFound && daysChecked < maxDaysToLook) {
// ...
}
Setting It Up
- Install the Templater plugin in Obsidian
- Copy the template to your templates folder
- Configure daily note template settings
- Customize the file path to match your structure:
const filePath = `Your/Folder/Path/${fileName}.md`;
Making It Your Own
Want to take it further? Here are some ideas:
- Add multiple section tracking
- Include meeting notes detection
- Add stats about days since last work
- Integrate with task tracking systems
Real-World Impact
Since implementing this template:
- No more scrambling during standups
- Better continuity between workdays
- Quick access to previous work items during meetings
What’s Next?
I’ve open-sourced the template on GitHub link, so you can:
- Use it as is
- Customize it for your needs
- Contribute improvements
- Share your own tweaks
The code is MIT licensed, and I’d love to see how you adapt it for your workflow. Check out the GitHub repository for the full code and documentation.