feat: generate static HTML redirect files for old Docusaurus URLs#756
Open
viccuad wants to merge 2 commits into
Open
feat: generate static HTML redirect files for old Docusaurus URLs#756viccuad wants to merge 2 commits into
viccuad wants to merge 2 commits into
Conversation
20c6107 to
6aef505
Compare
Add scripts/generate-redirects.sh, which creates meta-refresh HTML files at old flat paths (e.g. /reference/threat-model/index.html) pointing to the new Antora URL structure (/admc/1.35/en/...). Wire into both `make community-remote` and `make community-local` targets so GitHub Pages serves the redirects without needing server-side configuration. Signed-off-by: Víctor Cuadrado Juan <vcuadradojuan@suse.de>
Signed-off-by: Víctor Cuadrado Juan <vcuadradojuan@suse.de>
✅ Deploy Preview for docs-kubewarden-io ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Member
Author
✅ Deploy Preview for docs-kubewarden-io ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
jvanz
approved these changes
May 20, 2026
There was a problem hiding this comment.
Pull request overview
This PR replaces Netlify-based redirect rules with generated static HTML meta-refresh redirect files so legacy (Docusaurus-style) URLs continue to work when hosting via GitHub Pages/gh-pages.
Changes:
- Added a Bash script to generate
index.htmlredirect files for legacy paths based on Antora page sources. - Wired redirect generation into the
community-localandcommunity-remoteMakefile targets. - Removed the catch-all redirect rule from
netlify.toml.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
scripts/generate-redirects.sh |
New script that scans Antora pages/ sources and writes static HTML redirect files into the built site output. |
Makefile |
Runs redirect generation after building the site for both local and remote build targets. |
netlify.toml |
Removes the previous Netlify /* redirect configuration. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+43
to
+45
|
|
||
| # Skip if a real file already exists at this path (Antora owns it) | ||
| if [ -e "${SITE_DIR}/${rel}.html" ] || [ -d "${SITE_DIR}/${rel}" ]; then |
Comment on lines
+37
to
+40
| ./scripts/generate-redirects.sh \ | ||
| docs/admc/version-1.35/modules/en/pages \ | ||
| build/site \ | ||
| /admc/1.35/en |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
This PR removes the Netlify redirect configuration and moves to have static files that redirect.
This allows us to keep serving the page with gh-pages.
Add scripts/generate-redirects.sh, which creates meta-refresh HTML files at old
flat paths (e.g. /reference/threat-model/index.html) pointing to the new
Antora URL structure (/admc/1.35/en/...).
Wire into both
make community-remoteandmake community-localtargets so GitHub Pages serves the redirects without needing server-side
configuration.
Remove unneeded Netlify configuration for redirects.
Test
<netlify-preview>/admc/1.35/en/reference/threat-model.html, file exists, served directly<netlify-preview>/reference/threat-model, no file, redirected to /admc/1.35/en/reference/threat-model, Netlify then serves/admc/1.35/en/reference/threat-model.html`<netlify-preview>/admc/, file/directory exists, served directlyAdditional Information
On build, it creates the folder and file structure with html files, so one can hit the redirects:
This means that we cannot re-use a path like
build-local-community/site/howtosorbuild-local-community/site/introduction, but that's always the case with redirects.Tradeoff
Potential improvement
Checklist