Yeah, that’s a good suggestion, thanks, I’ll take a look (I foget they existed, haven’t used one in a very long time)
Just like how Each entry in the daily Log has a default Template — I was wondering if it was possible to create a default New Page - One with Date and Time stamp already laid out neatly inside the page.
+1 for built-in Note Templates - that would be awesome.
1+ I copy paste a lot to make this work as is.
+1 for templates!
@hugochisholm Yes you can set up a template for the daily notes page. What would be nice would be to select templates for other notes. I am in the process of building a CRM using Obsidian and a template for this would be great as well as a search function for the graphics page. Well Xmas is coming soon
One simple thought on this … UI currently offers “Make a copy” on a right-click in the navigation pane. This puts the copy in the same folder, rather than in the folder specified in Settings as the folder for new notes.
If there were an option to “Make a copy” in the new note location (either on the right-click menu in the navigation pane, or forced for all note copies in the Settings), that would allow for a quick-and-dirty implementation of templates. Go to a folder where you keep your templates, right-click the template and create a copy that lands as a new note.
I feel like templates are incomplete, they could be used in various ways and not only we can choose template when creating daily file, we can also can be prompted when creating a ny new files.
So my main idea is ,
In a template we can put variable like “$d-$m-$y” this it will expand into current date. There could be so many types of variable like, for search some tag and count the number of occurrences “$searchCount(#todo)” or we can just get return search results in the middle of a file by typing “$search(#todo)”
Yeah, some kind of template variables would be nice. At least for things like date.
+1 here, love the daily notes template, would love to see this expanded for other notes
+1
It could perhaps be something like how IDEs do code-snippets.
Maybe you can see a drop down of available snippets when you type a special character like ‘/’ with some customisable keys. For example /br
would insert the code snippet for notes on a book that you’re reading:
I would imagine we create beforehand, a code snippet for book notes that already contains some sections and commonly used tags, and some macros. Something like:
# $highlighted
Started reading: [[$today]]
tags: [[book notes]] [[reading]] $cursor
# Summary
# Key points
# Things to look up
So to invoke the snippet you first type out the book title,
The book title
, then highlight it and pressing /
would show a dropdown next to the cursor of available snippets. By further typing ‘b’, and ‘r’, it would narrow the available snippets to the the above snippet by matching the pre-configured pattern /br
.
Pressing enter would insert the text from the snippet and replace all the macros with relevant values. For example,
-
$highlighted
would place the text that was highlighted while invoking the code-snippet (the book title). -
$today
replaced with today’s date (in the format specified under the daily notes plugin?) -
$cursor
is where the cursor ends up after inserting the snippet.
Idea:
New page is created using syntax [[New page@reference]] from reference.md inside templates folder if file ‘New page.md’ does not exist yet. Otherwise, @reference has no effect. Without reference template inside the link, [[New page]] will be created as before - as an empty page
right now when we click on links to which pages don’t exist,a blank page is created.
Alternatively, if we could create a template for that - say, when a link without a page is clicked, a new page of the format →
Tags:
{{date}} | {{time}}
{{Linkname}}
will be created.
Similar Requests
Interesting idea. Do you imagine this feature would be part of the existing Templates plugin or somewhere else in the app?
I dunno. Initially when I read that there would be Templates, I imagined Page templates along the line of what Notion and OneNote.
; — Hope this is useful for the Template ambitious. I also have aspell for when an app doesn’t have spell check.
;- The AHK language is rather easy to do simple things like this, but can do javascript like stuff as well, or so it appears w/what I’ve looked at. I’ve used a couple of these macros for 6-7 years: Through 2-3 computers. Didn’t even have the compiler installed last 2 computers. Just the .exe files I’ve used. When I started using Obsidian, and wanted Template type automation, I re-downloaded it. In 2004, I didn’t think it would survive. Here’s one I’m building on since getting Obsidian.
; —
; — Cut all above
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
; - Insert Date Time stamp with - Ctrl+Numpad0 = 11:35 AM
^$Numpad0::
FormatTime, zz, HH:mm tt ; This type of the time format 05:35 AM
SendInput, %zz% ; send the varible zz to the document
Return ; stop sending varible to document
; - Insert Zettlekasten type date with - Ctrl+Shift+d = 2020-09-03
^+D::
FormatTime, xx, yyyy-MM-dd ; This date format is 2020-09-02
SendInput, %xx% ; send the varible xx to the document
Return ; stop sending varible to document
; - Insert Day, Month 1-30 (no leading 0), yyyy - LAlt+Shft+D = Thursday, September 3, 2020
<!+d::
FormatTime, yy, dddd, MMMM dd, yyyy ; This date format is Thursday, September 3, 2020
SendInput, %yy% ; send the varible yy to the document
Return ; stop sending varible to document
; — Cut this line and all below for script for these 3 macro to be ready to compile.
; —
; - on another note: Regarding this “macro” language and compiler:
; -
; * https://www.autohotkey.com ; AutoHotkey download page
; * https://www.autohotkey.com/docs/Tutorial.htm#s11 ; Downloading and installing AutoHotkey
; * https://github.com/stef-levesque/vscode-autohotkey ; github VSCode-AutoHotkey add in page
; * https://marketplace.visualstudio.com/items?itemName=yedhrab.yautohotkey ; Marketplace page for “best” add-in for latest stable release of Auto Hotkey - tho what it does is a mystery to me.
; * https://codeload.github.com/maestrith/AHK-Studio/zip/master ; AHD Studio, appears to require installed AHK Covert .ahk to .exe
; * https://www.autohotkey.com/docs/commands/Edit.htm#Editors ; Editors that support AHK (in addition to VS Code)
;
; - https://www.autohotkey.com/docs/commands/FormatTime.htm ; Some info is correct (like this page on times and dates) other pages not so much.
; - https://www.youtube.com/results?search_query=autohotkey ; Links for AutoHotkey videos.
Can I create several templates, and when I create a new file I can choose anyone of them?
Yes - I was just able to do this. Turn on the “Templates” plugin, create a folder called “Templates” and configure the plugin’s template directory to that folder. Then add any template you want.
The Daily Note plugin allows for the automatic creation of a Daily Note with a pre-defined format (for example, YYYY-MM-DD
) which will also populate with a template (native to the Daily Note plugin).
right now when we click on links to which pages don’t exist,a blank page is created. Alternatively, if we could create a template for that - say, when a link without a page is clicked, a new page of the format →
Preferably we’d be given the option to choose from existing templates.
I see zero reason to argue against templates per folder. Not everyone uses one folder for everything.
You should easily be able to apply a single template to the vault directory which would also be the default template for all folders unless explicitly set to be different for a specific folder.
This is a win win, both sides get the functionally they want. Not allowing templates per folder is a win lose situation