Add unique prefix on new notes created from wikilink

What I’m trying to do

I use unique prefix on my notes. I would like to be able to type [[something]] where that note does not exist yet. And when clicking on that like it would be replaced with [[{unique prefix}} something]] and the editor be left at this new note.

Alternative I would like to create the unique prefix at the time of writing [[something]], that would be fine to me.

I would love if the other configuration of the Unique note creator plugin are also used in this process. So the new file location and template are applied.

Thanks for the advice!

This isn’t quite what you’re asking for, but you could make a template that creates the same date string you have set for the Unique Note plugin and run it in the link before clicking.

You mean to use a template to generate a wikilink with a prefix? So while I am typing I would expand a template that would generate [[{prefix} ]] and then I can continue typing the rest of the non-existing note title?

You could do that, too, but it’s not what I was saying. It sounded like you were working with existing links, so I suggested to make a template containing only the prefix (like {{date:YYYYMMDDhhmmss}}). Then before clicking a link, place the cursor after the [[ and trigger the template.

1 Like

I see. Is not as smooth as I wanted but definitely a workaround.

Since obsidian will fix the links if the note name is change the template could be expanded in the title of the recently created note. But, even if the cursor is in the note’s title the templates are expanded in the body, so I need to cut/paste.

Thanks for the hints @CawlinTeffid

Yeah, templates don’t apply in the note name field.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.