Creating new folder and file based on link with relative path

In 11.1 a new feature was added that would create new files as well as new folders based on a link. I am not sure if this is a bug, or I am using it wrong.

Steps to reproduce

In a random folder create a note with an embedded link.

[[NewFolder/NewNote]]

Expected result

I would expect it to create a new folder in the current directory and a new file in the newly created directory.

Actual result

The new folder is created in the Root folder.

Environment

  • Operating system: W10
  • Obsidian version: 0.11.3

Additional information

I am using these new links in templates. To me, that is where this feature really shines. If you were creating the link by hand you could use absolute path, but wouldn’t the ability to make it relative also make sense. Thanks.

ce

4 Likes

The folders are created according to your settings in Files & Links and Default location for new notes for new link format. I am not sure how those two interact when you specify the folder as part of the links. As far as I know if you have Shortest path when possible this means at the root of your vault.

Yes Sir, I understand what you are saying and I would expect it to behave the same. My Default location for new notes is set to “Same folder as current file”. I think the issue is a new folder is created before a new note is created, so the new note option is probably not used. To me it would make sense for the new folder to follow the same option selected for new notes. I know that may be a bit confusing, but if we look at notes and folders as entities then it falls in line. Thanks for responding, and thanks for a great application.

ce

I am not sure why this got moved to Help. I assume you are saying it’s not a bug. That links that create folders as well as files will always default to root folder.

ce

Can you add a screenshot of the note you’re writing in and its location in the file explorer?

Yes. I am not yet sure this is neither a bug nor a feature request. Don’t worry, I’ll move it to the right category once I know for sure!

My Config setting, so no doubt…

The location of file which contains link…

2021-03-04 06_29_45-TestVault_ce - Obsidian v0.11.3

What my link looks like…

2021-03-04 06_30_00-TestVault_ce - Obsidian v0.11.3

Location of new folder and new note…

2021-03-04 06_30_29-TestVault_ce - Obsidian v0.11.3

Like I said in my original post, I believe the issue is the the newly created folder is not adhering to the New Note setting. I completely understand why that would be the case; folder vs note. It seems like a bit of overkill to have a new setting for just this use case. Thus my mention of just using the New note setting to apply to folders created in this manner. I would create a new setting, but also freely admit that I have OCD issues; LOLOL. I am sure if I include the full path it would work as expected. If I were to type it by hand, being able to use relative path makes sense. I am not typing the link, I am using it in templates, and once again being able to use relative path makes sense.

ce

1 Like

Alright, I can confirm that right now it’s not possible to specify relative paths in the inline links. Moving this to #feature-requests and editing the title to specify the use case

1 Like

Thanks. Sorry for the confusion.

ce

I am using Templater, so I used {{tp_folder:vault_path=true}} as part of my New link to get around the issue. I still think this would be a great feature to add for those not using Templater, or a plugin which will give you the full path to current folder. Thanks again for a great application.

ce

@Chuckle123, thank you for reporting and documenting this behavior.


This also occurs without Wiki links, i.e. with Markdown links.

Examples:

  • [example 1](NewFolder/NewNote)
  • [example 2](NewFolder/NewNote.md)
  • [example 3](./NewFolder/NewNote)
  • [example 4](./NewFolder/NewNote.md)

Questions

  1. @argentum (or Obsidian team or community), what other non-Templater workarounds exist? (I know only one.)

Workaround:

  1. Create file in folder (let Obsidian create folder and file as if from root).
  2. Move file to appropriate location.
  3. Confirm link does not update, but will still navigate to file.