Advertisement
Icalized

Obsidian template

Jun 8th, 2025 (edited)
374
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
JavaScript 0.72 KB | Source Code | 0 0
  1. <%*
  2. //Get file title
  3. let title = tp.file.title;
  4. if(title.toLowerCase().startsWith("untitled")){
  5. title = await tp.system.prompt("Title:");
  6. await tp.file.rename(title);
  7. }
  8.  
  9. // --- Get Category ---
  10. let category = await tp.system.prompt("Category:");
  11. if (category === ""){
  12.     // Force format
  13.     category += "/general";
  14. }
  15. const folder = category;
  16.  
  17. // --- Create Folder ---
  18. const folderPath = `${folder}/`;
  19. if (!await app.vault.adapter.exists(folderPath)) {
  20.   await app.vault.createFolder(folderPath);
  21. }
  22.  
  23. // --- Move Note ---
  24. await tp.file.move(`${folderPath}${title}.md`);
  25.  
  26.  
  27. %>
  28.  
  29. Created : <% tp.date.now("dddd, MMMM Do YYYY, h:mm:ss a") %>
  30. Curated Links :
  31. Auto Links:
  32.  
  33. ___
  34. <% tp.file.cursor() %>
  35.  
  36. # References
  37.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement