[Absolute or Relative path] `Default location for new notes` should be ignored when creating files by following a link. The link itself should be used

When absolute path or relative path is used, the location directed by a link should be definite.

For example,
when absolute path is used, the link [[file]] should refer to a file named file in the directory root;
when relative path is used, the link [[file]] should refer to a file named file in the folder of the current file.

Since the location directed by a link is definite, there is no need to set a Default location for new notes. If the link [[file]] directs to a file not yet created, then just create the file in the directed location.

Currently, create new notes from relative path is very problematic as noted in a related feature request Obsidian has trouble creating new notes from “Relative path to file” links, but if this feature is going to be implemented, then naturally, the Default location for new notes setting is redundant and should be disabled when relative path is used.

2 Likes

This is unlikely to happen because it will imply that [[file]] points to a note under one link format and to another note under a different link format.

What is more likely to happen is that in relative path mode (once properly fixed/implemented) a link is forced to have a leading ./ or ../.

[[./below/dir/file]] [[../up/dir/file]].

Hi WhiteNoise,

Creating new file from absolute/relative path may be difficult to implement but it is a very helpful feature. Otherwise you have to break it into two steps, i.e. create the new file in the desired location and then link to it in the current file. The workaround seems OK but it is very distractive.

What’s more, implementing this feature will also take care of the other feature requests: Create new file from link when the same file name is used in another folder, Obsidian has trouble creating new notes from “Relative path to file” links.

In terms of the ambiguity as a result of different link formats, I think it can be solved by, for example, converting all the links in the vault to relative paths when switching from other path modes to relative path mode. So in relative path mode, all the links are in relative path mode, and there is no ambiguity.

Hi WhiteNoise,

Will you consider adding a format conversion feature that converts all the links in the vault to either absolute or relative path links? This will make all the links in the vault consistent in format and also make the feature requested here in this thread possible.

You can open another FR for the conversion.
It will not solve this FR because we don’t want that [[file]] points to a file under one rule and to another file under a different rule. What will solve this FR is forcing relative users to have links that begin with either ./ or ../.

EDIT: renamed this FR.

I think it doesn’t matter that " [[file]] points to a file under one rule and to another file under a different rule", because every time you switch to another mode, the [[file]] will be converted to, say, [[…/file]], and it still points to the same file.

But anyway, you are the expert in this kind of problems, and I’m sure you have your considerations. I 100% respect your decisions.

Thank you so much!

Steps to reproduce

In a subfolder within a vault, insert an explicit relative link [[./x/y]]. Hover-preview the link and click to open it, or use the open link under cursor command.

Expected result

A note x/y.md is created in a subdirectory of the folder the note is in, and the note is opened

Actual result

The operation silently fails after creating x/y.md under the vault root.

Environment

  • Operating system: Windows
  • Obsidian version: 0.12.19

Additional information

It doesn’t matter what the link creation setting is set to.

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

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.

Discussing the “bug” Cannot create note by clicking link if it contains slashes we came up with the idea

Would you at least consider to have a setting to make links relative? For those who rely on current behavior, they just won’t set it

1 Like