Daily Note With Open Previous Button

Here is a Daily Note Template that has a button that will trigger opening the previous daily note.

Not day - 1 but rather the previous note in the daily note directory.

  1. Remember to be kind to others.
  2. Avoid Negative Conversation Comments.
  3. Look for Positive Things to Do for Others.

TEMPLATE: [[01 - SUPPORT FILES/TEMPLATES/TMP - DAILY NOTE|DAILY NOTE]]

Task List(s) Links

[[View - Inbox|Inbox]]
[[View - Today|Today]]
[[View - Upcoming|Upcoming]]
[[View - Anytime|Anytime]]
[[View - Someday|Someday]]
[[1 - PRIORITY TASKS|Priority Tasks]]
[[CAD STANDARD TASKS|CAD Standards Tasks]]
[[CAD DESIGN TASKS|Design Detail Tasks]]
[[OBSIDIAN PROJECT TEMPLATE TASKS|Obsidian project Template Tasks]]

const vaultBasePath = "D:/OBSIDIAN DATA/PROJECTS";  // Adjust to match your vault location
const folderName = "03 - DAILY NOTES";  // Ensure it matches your folder name exactly

// Get current note's filename
const currentFileName = dv.current().file.name;

// Retrieve all markdown files in the directory, sorted in order
const allNotes = dv.pages().filter(p => p.file.folder === folderName).file.name.sort();

// Find the previous note in the sorted list
const currentIndex = allNotes.indexOf(currentFileName);
const previousNote = currentIndex > 0 ? allNotes[currentIndex - 1] : null;

if (previousNote) {
  // Construct full absolute path correctly
  const previousNotePath = `obsidian://open?path=${encodeURIComponent(vaultBasePath + "/" + folderName + "/" + previousNote)}`;

  console.log("Resolved Previous Note Path:", previousNotePath);

  // Generate interactive button
  const buttonHTML = `
    <button 
      onclick="location.href='${previousNotePath}'"
      style="
        background-color: var(--interactive-accent);
        color: var(--text-on-accent);
        border: none;
        border-radius: 6px;
        padding: 6px 12px;
        font-size: 0.9em;
        cursor: pointer;
        box-shadow: 0 2px 4px rgba(0,0,0,0.15);
      ">
      ⬅️ Previous Daily Note (${previousNote})
    </button>`;

  dv.container.innerHTML = buttonHTML;
} else {
  dv.paragraph("❌ No previous daily note found in `" + folderName + "`.");
}

:fire:Priority Task Report

not done
description includes #PT

Rolling To-Do’s, Ctrl +Shft +R

Completed

done on {{date}}

Habits

Sleep:: 0
Reading:: 0
Exercise:: 0
Meditation:: 0
Writing:: 0
Sketching:: 0
Math:: 0
SQL:: 0

PRO TIP: CTRL + L TO INSERT TASKS

To-Do

Morning Tasks

  • 09:00 - GOTTO GYM

Afternoon Tasks

Evening

  • 18:00 Enter Tomorrows Comments

Reflection & Review

  1. What were the positives today?
  2. What could I have done better?
  3. What did I learn today?

[!info] Tomorrow’s Comments
..
..
..

Best Regards
-Tim C.