docs - add manual redirects scripts #2178
Merged
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.
Summary
Docusaurus has a redirects plugin. It doesn't handle redirecting from hashes (like
concepts#web-api
) which is how the old site worked. I wrote a script to redirect the pages likeconcepst#web-api
toconcepts/web-api
.I also used the redirects plugin for normal, specific, redirects.
It seems the two are clashing. With the plugin, and only in prod,
/concepts#web-api
gets redirect to/concepts/#web-api
instead, which doesn't work. ChangingtrailingSlashes
param doesn't fix it. Removing the plugin fixes it, though, so I added an additional redirects script for redirecting specific pages:redirects-pages.js
.The only pages redirected right now are category pages that didn't have content, but are links people might have bookmarked. And
/
, as there's no landing page yet. All just go togetting-started
I tested it on
build
andserve
, but also the previous iteration worked there. So I also tested the setup on a deployed docusaurus site on a personal repo. It works in prod there.Requirements