Create and link to new unique note

I have the same question as this closed thread, actually, but I wanted to get specific about all the steps that are involved in case there are partial answers that could make the experience nicer for me:

  1. Open Obsidian on iPhone
  2. Write some text that I want to link to a new unique note
  3. Create the new note and copy its name
    1. Tap “Create new unique note” in the keyboard toolbar to open a new “unique note”
    2. Double-tap the file name and copy it
    3. Tap into the note body (to make the keyboard toolbar appear again)
    4. Tap the keyboard toolbar button that closes the toolbar
    5. Tap the back button to get to the original note
  4. Create a link to that note
    1. Highlight the text I want to link
    2. Tap the keyboard toolbar action to surround it with square brackets
    3. Move the cursor to the start of the text
    4. Paste the unique note’s name with a triple-tap to avoid moving the cursor again
    5. Type a “|” character
  5. Tap the keyboard toolbar button to close the keyboard
  6. Tap the new link to get back to the new note

It’s similarly tedious on macOS, though there are hotkeys for things like copy, paste, back, etc, that speed up some parts of it.

I made a Shortcut that puts a timestamp with the same unique page name format onto my clipboard. I have to leave the app to trigger it, but this lets me create the link without breaking my writing flow by leaving the page.

I could be reading this wrong. But you do not have to create the target of link at the same time. Once you’ve created the link in the source note, all you have to do is click on it and a new new is automagically created with that name.

In step 2 - as soon as you create the text, select it and type [[ … the link is created, then just click on it and, poof, the new note with that name is created.

Thanks, yeah, that’s key to why having a Shortcut to generate a unique note name helps. The only “Create new unique note” actions built into Obsidian create notes and take you to them—there are no corresponding actions to create links to unique notes that don’t exist yet.

I’m just thinking out loud here, but if I understand you correctly you want to type a text, select it and create an unique note with your text as an alias, but without actually writing anything into the new note, just yet.

In theory I can’t see why this can’t be done using a template:

  • The selected text is picked up by tp.file.selection()
  • Create an unique note could be done in two different variants:
    • Option A: Using the Create new unique note command
      • Tap into the event queue for creating new notes
      • Trigger the Create new unique note command
      • Use the create callback somehow to give the new name back to the template execution
    • Option B: Create the unique note yourself
      • Recreate the creation of the new using the same kind of template/dateformat to create the new note
      • Create it, optionally with using some template
      • Return the new note name back to the template
  • Return back an aliased link based upon the new note name, and the previously selected link

Is there something I’m missing? Shouldn’t this be somewhat simple to do? And I believe if the unique name pattern isn’t too hard, it should be very doable using only existing Templater logic. If one would need to tap into the create-event it could become a little more difficult, but even that option should be doable.

So my question is then; Is there something obvious (and hard) with this use case I’m missing out on?

Just chalk it up to my ignorance. :sweat_smile: I’ve created two page templates that I use daily, but I don’t know what tp.file.selection() could refer to, what the event queue is, how to use a create callback, or what Templater is.

Some searching makes me believe that all of that refers to pieces of Is that the template plugin I’m already using, or is this its whole side ecosystem?

I’m talking about the Templater plugin, yes. Stuff like this is not supported in the core templates plugin which you linked to.

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