Relative links

Being able to use relative links supports easy “refactoring” of some nested document.

So if I have nested/this and nested/that, I’d like to link from this to that without knowing they are all inside nested. So at least with [[./that]], but to support every workflow, may I suggest to introduce a new setting for using relative links by default?

With the new setting for using relative links, if I have a page called nested/this, and have a link inside like [[that]], it will link to nested/that.

At some point I did a massive amount of work to switch from absolute links (that we use now) to relative links. The idea was that [[bla]] in the context of folder/bla2 would linke to folder/bla, and to link to the root, you’d use ../some root link. While I backed out of this change, it did become very clear how many edge cases there are, and how much it affect refactoring operations (like renaming of pages, attachments etc.). As a result it’s also clear that supporting both models would be pretty damn complicated, let alone allowing to switch between them. I mean, what if you toggle this setting, would you expect all links in your entire space to be rewritten to follow the new semantics? And then back again when you toggle it again?

What we can consider, is to also support a relative link syntax (and maybe that already works I don’t remember :laughing: ), like index [[./bla]] which would always resolve relatively, and then have a setting to e.g. auto complete to relative links rather than absolute links. That would be more doable, but honestly I think relative links like [[./bla]] just look ugly so I wouldn’t use this myself :wink:

Yes, changing that setting is dangerous. But this program is for hackers, right? :wink:

Changing a setting should not modify your files at all! It just modifies the resolving of the links.

Which would then be broken, no?

Yes, links from nested directories would be broken / need to be converted.

But you can either:

  • disable that option if you have links from nested pages or if links become invalid
  • develop a “Broken page” section to point this out (this would be useful independent of this thread)
  • store the setting somewhere else and either
    • disable changing it
    • convert when option is changed (I wouldn’t recommend it though)