# Option to clean up Relative and Absolute Links by default

**URL:** <https://forum.obsidian.md/t/option-to-clean-up-relative-and-absolute-links-by-default/5399>\
**Category:** Feature archive\
**Tags:** valuable\
**Created:** [September 8, 2020, 4:58am UTC](https://forum.obsidian.md/t/option-to-clean-up-relative-and-absolute-links-by-default/5399 "2020-09-08T04:58:12Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![goodsignal](https://forum.obsidian.md/user_avatar/forum.obsidian.md/goodsignal/32/129_2.png) [@goodsignal](https://forum.obsidian.md/u/goodsignal)\
**Post date:** [September 8, 2020, 4:58am UTC](https://forum.obsidian.md/t/option-to-clean-up-relative-and-absolute-links-by-default/5399/1 "2020-09-08T04:58:12Z")

</div>

I prefer using **“Shortest path when possible”** with my internal links. But when I consider compatibility with other editors and viewers, I’m feeling the need to switch my settings to **“Relative path to file”**.

Some people want to see all the information in the preview. Some people don’t.

It would be great to have an additional setting that auto-generated a pretty link in our markdown when these long link formats are set.

## For example,

When `[[Review Cafe]]` is entered in Edit mode, currently this is generated:

`[[../Meta/Templates/Business Reviews/Review Cafe]]`

but with a new setting it could generate as:

`[[../Meta/Templates/Business Reviews/Review Cafe|Review Cafe]]`

So that in Preview, this

> Here is the ../Meta/Templates/Business Reviews/Review Cafe template.

becomes the clean and legible:

> Here is the Review Cafe template.

Of course we can modify it, but this would be a welcome default on long links to keep our Previews clean and easy to read.

## Related

This pipe format may be a simpler solution that this

> [@Toggle to show/hide full relative paths in preview](https://forum.obsidian.md/t/toggle-to-show-hide-full-relative-paths-in-preview/3664):
>
> Steps to reproduce Set the New link format to Relative path to file Create a new internal link to any note that’s in a sub or parent folder Expected result The path of the link is shown in editor and only note name in preview. Actual result The preview mode also shows the path. Additional information Posting screenshots of both edit and preview mode with the default link style vs relative. [image] [image]

> [@Best option to choose for "New Link Format"?](https://forum.obsidian.md/t/best-option-to-choose-for-new-link-format/3675):
>
> I’m a bit confused on which option to choose for “New Link Format” and want to get it right as I understand that previous links can’t be automatically changed when changing this option. My Obsidian vault is on iCloud Drive and I do minimal editing in my iPad on 1Writer (until Obsidian mobile come out) and primarily use my MacBook Pro for Obsidian use. Thanks in advance for any help on this.

---

<div class="post-metadata">

**Author:** ![connorhodes](https://forum.obsidian.md/user_avatar/forum.obsidian.md/connorhodes/32/4557_2.png) [@connorhodes](https://forum.obsidian.md/u/connorhodes)\
**Post date:** [September 23, 2020, 12:20am UTC](https://forum.obsidian.md/t/option-to-clean-up-relative-and-absolute-links-by-default/5399/2 "2020-09-23T00:20:43Z")

</div>

I would also like this for exactly the same reason.

---

<div class="post-metadata">

**Author:** ![connorhodes](https://forum.obsidian.md/user_avatar/forum.obsidian.md/connorhodes/32/4557_2.png) [@connorhodes](https://forum.obsidian.md/u/connorhodes)\
**Post date:** [September 23, 2020, 12:27am UTC](https://forum.obsidian.md/t/option-to-clean-up-relative-and-absolute-links-by-default/5399/3 "2020-09-23T00:27:52Z")

</div>

One thing I will add, is that this is already how Markdown style links function.

`[type 1 lsa](tech/network_engineering/type%201%20lsa.md)`

will be rendered as

`type 1 lsa`

in the preview.

---

<div class="post-metadata">

**Author:** ![varian93](https://forum.obsidian.md/letter_avatar_proxy/v4/letter/v/3bc359/32.png) [@varian93](https://forum.obsidian.md/u/varian93)\
**Post date:** [October 16, 2020, 12:11pm UTC](https://forum.obsidian.md/t/option-to-clean-up-relative-and-absolute-links-by-default/5399/4 "2020-10-16T12:11:45Z")

</div>

An issue that I’ve noticed with either using standard markdown links or Obsidian’s “Wikilink Pipe” to change the appearance of the text in preview mode is that when the file that the link points to gets renamed the “pretty” text does not get renamed as well.

I can see situations where it would be preferable for it to be renamed too, as well as others where it would not.

I was originally using relative markdown style links out of concern for compatibility with other software, but once I noticed the pretty text not being renamed I gave up on that. I now use wikilinks & “shortest possible”. It’s the only way that I’m guaranteed that the pretty text will always be the same as the file name.

I reasoned that with a proper markdown export as well as a mobile app on the way, if I ever needed to work on something with a 3rd party app that I could just export it as proper markdown.

Although I’d definitely much prefer an option that would allow me to use 3rd party software without having first to export it to proper markdown.

---

<div class="post-metadata">

**Author:** ![Grayda](https://forum.obsidian.md/user_avatar/forum.obsidian.md/grayda/32/43617_2.png) [@Grayda](https://forum.obsidian.md/u/Grayda)\
**Post date:** [February 20, 2023, 11:28pm UTC](https://forum.obsidian.md/t/option-to-clean-up-relative-and-absolute-links-by-default/5399/5 "2023-02-20T23:28:39Z")

</div>

### Use case or problem

When creating new links, I use the `Absolute path in vault` setting under `Settings` \> `Files & Links` \> `New Link Format` because I like to see exactly where a file lives in the vault.

I also find myself manually adding the page title after that so it looks nice when I preview it, so for example:

`[[People/Smith/John Smith|John Smith]]`

I’d like to see a way to have the page title automatically appended to the link so I don’t have to do it manually.

### Proposed solution

Add another toggle to the `Files & Links` page, `Add page title to auto-generated internal links` or something, which when enabled, would mean auto-generated internal links would go from `[[People/Smith/John Smith]]` when inserted, to `[[People/Smith/John Smith|John Smith]]` when inserted

### Current workaround (optional)

Currently doing it manually. It’s not too difficult, but it gets tedious when I’m working with a lot of links.

### Related feature requests (optional)

> [@Option to clean up Relative and Absolute Links by default](https://forum.obsidian.md/t/option-to-clean-up-relative-and-absolute-links-by-default/5399):
>
> I prefer using “Shortest path when possible” with my internal links. But when I consider compatibility with other editors and viewers, I’m feeling the need to switch my settings to “Relative path to file”. Some people want to see all the information in the preview. Some people don’t. It would be great to have an additional setting that auto-generated a pretty link in our markdown when these long link formats are set. For example, When [[Review Cafe]] is entered in Edit mode, currently this is…

---

<div class="post-metadata">

**Author:** ![AlanG](https://forum.obsidian.md/user_avatar/forum.obsidian.md/alang/32/55225_2.png) [@AlanG](https://forum.obsidian.md/u/AlanG)\
**Post date:** [February 21, 2023, 12:51am UTC](https://forum.obsidian.md/t/option-to-clean-up-relative-and-absolute-links-by-default/5399/6 "2023-02-21T00:51:40Z")

</div>

I agree with the feature request, sounds like a good idea.

> [@Grayda](#):
>
> Currently doing it manually. It’s not too difficult, but it gets tedious when I’m working with a lot of links.

You could make a slightly better workaround by using Templater and hitting one hotkey to automatically update your links.

Assuming your cursor is directly after a link having just inserted it, the Templater script would:

1. Read the contents of the file up to the current cursor position.
2. Regex to find the page name of the last link in the contents.
3. `tp.file.cursor` to move the cursor to the left of the closing link `]]`
4. `tp.file.cursor_append` to add `|Page title`
5. `tp.file.cursor` to move the cursor to the end of the link again

You could make this even more efficient by putting your own file-chooser in the script and using your hotkey to insert all links, but you might just want to augment the default link inserting rather than replace it.

---

<div class="post-metadata">

**Author:** ![WhiteNoise](https://forum.obsidian.md/user_avatar/forum.obsidian.md/whitenoise/32/11_2.png) [@WhiteNoise](https://forum.obsidian.md/u/WhiteNoise)\
**Post date:** [March 14, 2023, 7:22pm UTC](https://forum.obsidian.md/t/option-to-clean-up-relative-and-absolute-links-by-default/5399/7 "2023-03-14T19:22:55Z")

</div>

will be implemented v1.2

---

<div class="post-metadata">

**Author:** ![WhiteNoise](https://forum.obsidian.md/user_avatar/forum.obsidian.md/whitenoise/32/11_2.png) [@WhiteNoise](https://forum.obsidian.md/u/WhiteNoise)\
**Post date:** [March 28, 2023, 8:30pm UTC](https://forum.obsidian.md/t/option-to-clean-up-relative-and-absolute-links-by-default/5399/9 "2023-03-28T20:30:40Z")

</div>

Opened on March 28, 2023, 8:30pm UTC



---

<div class="post-metadata">

**Author:** ![system](https://forum.obsidian.md/uploads/default/original/3X/b/e/bec35fbd23ab28909bb6bfe62cb32eb82dd34019.png) [@system](https://forum.obsidian.md/u/system)\
**Post date:** [June 26, 2023, 8:31pm UTC](https://forum.obsidian.md/t/option-to-clean-up-relative-and-absolute-links-by-default/5399/10 "2023-06-26T20:31:36Z")

</div>

Closed on June 26, 2023, 8:31pm UTC

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