Skip to content

Instantly share code, notes, and snippets.

@ScribbleGhost
Created August 31, 2025 12:37
Show Gist options
  • Save ScribbleGhost/77497bca7d0bbb720e239644806e2cc8 to your computer and use it in GitHub Desktop.
Save ScribbleGhost/77497bca7d0bbb720e239644806e2cc8 to your computer and use it in GitHub Desktop.
A "Templater" template used to add a UUID to the title and id property of Obsidian notes

<%* function uuidv4() { return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) { const r = Math.random() * 16 | 0; const v = c === 'x' ? r : (r & 0x3 | 0x8); return v.toString(16); }); }

const uuid = uuidv4();

// Rename the file using Templater await tp.file.rename(uuid);

// Insert frontmatter with ID -%>

id: <% uuid %>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment