Using a relative link as directed (https://help.github.com/articles/about-readmes/#relative-links-and-image-paths-in-readme-files) in a PULL_REQUEST_TEMPLATE.md does not relatively link correctly.
When viewed in an actual PR:
-
[CONTRIBUTING.md](/.github/CONTRIBUTING.md)
routes to: https://github.com/.github/CONTRIBUTING.md
.
[CONTRIBUTING.md](.github/CONTRIBUTING.md)
-
[CONTRIBUTING.md](./.github/CONTRIBUTING.md)
route to:
https://github.com/owner/repo/compare/.github/CONTRIBUTING.md
instead of https://github.com/owner/repo/.github/CONTRIBUTING.md
.
Changing to ../
to go up a level would work for PRs, but would break the link when viewed in the GitHub UI.
Clicking the link as viewed on GitHub works: https://github.com/fs-webdev/fs-dialog/blob/master/.github/PULL_REQUEST_TEMPLATE.md, just not inside a PR.
(I feel like this used to work in 2017)
What is the correct way to have the relative link function as expected in both cases?
/
. Try removing the/
at the start of the link. In fact the linked documentation suggests./
(the dot is before the slash not after) while you have/.
– Laundryhttps://github.com/owner/repo/compare/.github/CONTRIBUTING.md
, since that is the route a PR originates from. – Gautamagithub/CONTRIBUTING.md
or./github/CONTRIBUTING.md
. – Laundry