Fix invalid links when served with trailing slash #212
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The Issue:
Visit this URL directly: https://docs.darklang.com/contributing/getting-started
301 Redirects to (note trailing slash): https://docs.darklang.com/contributing/getting-started/
The internal links on this page are now invalid, for example - https://docs.darklang.com/contributing/getting-started/if-you-dont-know-ocaml
if-you-dont-know-ocaml
is getting appended tohttps://docs.darklang.com/contributing/getting-started/
If you navigate to this page through JS, avoiding the 301 redirect and actually arriving at https://docs.darklang.com/contributing/getting-started (no trailing slash) then
if-you-dont-know-ocaml
is getting appended tohttps://docs.darklang.com/contributing/
and the link is correct.I encountered this by navigating to the contributor docs from the dark README link, https://darklang.github.io/docs/contributing/getting-started, which ultimately leaves you on the trailing slash page with invalid links.
See some discussion here - facebook/docusaurus#3372 and facebook/docusaurus#5250.
The simplest fix seems to be linking directly to documents instead of using URL paths, as I have applied here for just the contributing pages.
There is a
trailingSlash
added from version2.0.0-beta.df8a900f9
onwards, however upgrading to this seemed to have numerous breaking changes.