Created
February 2, 2025 17:00
-
-
Save alaestor/d3d05377902a7be00a731a8b16559fb4 to your computer and use it in GitHub Desktop.
Obsidian daily-note navigation buttons
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function mkBtnMeta(id, icon, cmd) { | |
return `\`\`\`\`meta-bind-button | |
label: "" | |
icon: ${icon} | |
hidden: true | |
class: "" | |
tooltip: "" | |
id: ${id} | |
style: primary | |
actions: | |
- type: command | |
command: ${cmd} | |
\`\`\`\`\n`; | |
} | |
function mkBtn(id) { | |
return `\`BUTTON[${id}]\``; | |
} | |
const prev = "dailynav-prev"; | |
const today = "dailynav-today"; | |
const next = "dailynav-next"; | |
dv.paragraph( | |
mkBtnMeta(prev, "chevron-left", "daily-notes:goto-prev") + | |
mkBtnMeta(today, "calendar", "daily-notes") + | |
mkBtnMeta(next, "chevron-right", "daily-notes:goto-next") + | |
`${mkBtn(prev)} ${mkBtn(today)} ${mkBtn(next)}`) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This Dataview JS script generates and inserts markdown to create user-friendly Meta-Bind buttons that utilize Obsidian's built-in daily-notes commands. It gets loaded at the top of my daily notes with dv.view("path/to/daily.js") for maintainability.