-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Description
Problem
Using absolute URLs may not work, if the final page is on a sub-page. For example, if a page is hosted on https://example.com/blog will an absolute URL such as /foo/bar result in a link pointing to https://example.com/foo/bar, breaking sites.
The idea
An option should be added which would do either one of two things:
- Prepend the sub-page to the absolute URLs, so that
/foo/barturns into/blog/foo/bar - Turn the absolute path into a relative path, meaning that the link
/foo/barlocated in/docs/example/index.mdbecomes../foo/bar
Why?
The usage of relative URLs can be tedious. While text editors such as VSCode may offer QoL stuff such as displaying folders and files when creating a relative path, is that feature not available for everyone obviously.
In addition can a relative URL also cause issues when you move pages around, as it would then require to edit any relative URL in all moved pages to match the new path (or edit relative paths pointing to the moved pages/files).
With having MkDocs deal with it, I could simply provide /assets/img/cat.png and no matter where I move the page, the link would properly resolve to the right relative path (or absolute path if the prepending option is used) reducing headaches when trying to resolve relative paths...