← [[Automated Notes|Intro]] ⦿ [[Prerequisites]] ⦿ [[Create a daily note|Create]] ⦿ [[Daily note with Time Tracking|Track]] ⦿ [[Weekly Notes|Weekly]] ⦿ [[Dynamic content|Dynamic]] ⦿ [[Reports|Reports]] ⦿ Samples →
## Weekly Notes
Create `Templates/get-weekly-content.md`:
```
<% tp.user["get-weekly-content"](tp) %>
```
Turn on Settings .. Calendar .. Show week number.
![[Show week number.png]]
Then in Settings .. Periodic Notes, turn on Weekly Notes
![[Weekly Notes.png]]
Set the format, template, and folder to:
- `gggg-[W]ww`
- `Templates/get-weekly-content.md`
- `Daily` - you could also set this to "Weekly" if you prefer to keep your Weekly and Daily notes separate.
Now Calendar will have a week number you can click on to get a weekly note (e.g. `2026-W07`), but don't click yet... first add this to `Scripts/get-weekly-content.js`:
```js
function getWeeklyContent(tp) {
const currentFileName = tp.file.title;
// Parse filename to get week
const weekMatch = currentFileName.match(/(\d{4})-W(\d{2})/);
if (!weekMatch) {
return "`couldn't parse week from filename`";
}
const year = parseInt(weekMatch[1]);
const weekNum = weekMatch[2];
const sunday = moment().year(year).week(weekNum).day(0);
let content = `---\n`;
content += `created: ${moment().format('YYYY-MM-DD HH:mm')}\n`;
content += `week: ${year}-W${weekNum}\n`;
content += `type: weekly\n`;
content += `---\n\n`;
content += `# Week ${weekNum} - ${year} (${sunday.format('M/D')} - ${sunday.clone().add(6, 'days').format('M/D')})\n`;
content += `## Summary\n`;
content += `Some fun I had this week\n`;
content += `## Daily Notes\n`;
for (let i = 0; i < 7; i++) {
const day = sunday.clone().add(i, 'days');
const dayDateStr = day.format('YYYY-MM-DD');
const filename = `Daily/${dayDateStr}.md`;
const file = app.vault.getAbstractFileByPath(filename);
if (file) {
content += `### ${day.format('dddd')} - [[${dayDateStr}]]\n`;
content += `![[${dayDateStr}#Today]]\n\n`;
}
}
return content;
}
```
Now when you click on the weeknum in the Calendar view it will open `Templates/weekly.md`, which invokes `getWeeklyContent(tp)` to populate the new weekly note. Clicking on a weeknum that already has a note just opens the existing note.
---