package.elm-lang.org icon indicating copy to clipboard operation
package.elm-lang.org copied to clipboard

Relative links in the README break when URL doesn't have a trailing slash

Open jfmengels opened this issue 6 years ago • 1 comments
trafficstars

Problem: Relative links in the README break when URL doesn't have a trailing slash

SSCCE

Does not work:

  • Go to https://package.elm-lang.org/packages/jfmengels/lint-unused/1.0.0
  • Click on the link to NoUnused.Variables link
  • Notice a redirection to https://package.elm-lang.org/packages/jfmengels/lint-unused/NoUnused-Variables, which does not exist

Works:

  • Go to https://package.elm-lang.org/packages/jfmengels/lint-unused/1.0.0/ (same URL but with a trailing slash)
  • Click on the link to NoUnused.Variables link
  • Notice a redirection to https://package.elm-lang.org/packages/jfmengels/lint-unused/1.0.0/NoUnused-Variables, which does exist

Description

It seems that relative links, like the one to NoUnused.Variables, which links to ./NoUnused-Variables do not direct to the same location when the current URL has a trailing slash and hasn't. With the URL.

Thoughts

Maybe relative links from the README are not a good idea, since they do not redirect to the correct page when reading the README on GitHub either. I have searched for other packages that link to their modules, and could only find rtfeldman/elm-css and elm-explorations/test which have an absolute path to the packages website, containing /latest/. I don't think is great either, because you are potentially redirecting users to a different version of the package (which may or may not have the functions linked to).

That said, I think adding a trailing slash to the url when the page loads solves the problem.

I noticed this because in other packages, I linked to this package with the URL not having a trailing slash. The problem does not occur when finding a package from the packages search page. In the meantime, I have added a trailing slash to my links to the packages.

jfmengels avatar Sep 18 '19 12:09 jfmengels

Just FYI, I noticed this problem with the links in Ellie and elm-search. I have opened issues there too.

jfmengels avatar Oct 02 '19 07:10 jfmengels