Skip to content

feat: generate static HTML redirect files for old Docusaurus URLs#756

Open
viccuad wants to merge 2 commits into
kubewarden:mainfrom
viccuad:feat/static-redirects
Open

feat: generate static HTML redirect files for old Docusaurus URLs#756
viccuad wants to merge 2 commits into
kubewarden:mainfrom
viccuad:feat/static-redirects

Conversation

@viccuad
Copy link
Copy Markdown
Member

@viccuad viccuad commented May 19, 2026

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-remote and make community-local
targets 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 directly

Additional Information

On build, it creates the folder and file structure with html files, so one can hit the redirects:

$ ls -la build-local-community/site
total 2228
drwxrwxr-x 18 vic vic    4096 May 19 16:14 ./
drwxrwxr-x  3 vic vic    4096 May 19 16:14 ../
drwxrwxr-x  7 vic vic    4096 May 19 16:14 _/
-rw-rw-r--  1 vic vic    6837 May 19 16:14 404.html
drwxrwxr-x 13 vic vic    4096 May 19 16:14 admc/
drwxrwxr-x  2 vic vic    4096 May 19 16:14 disclosure/
drwxrwxr-x  2 vic vic    4096 May 19 16:14 enterprise/
drwxrwxr-x 10 vic vic    4096 May 19 16:14 explanations/
drwxrwxr-x  2 vic vic    4096 May 19 16:14 glossary/
drwxrwxr-x 30 vic vic    4096 May 19 16:14 howtos/
-rw-rw-r--  1 vic vic     553 May 19 16:14 index.html
-rw-rw-r--  1 vic vic     538 May 19 16:14 index.html.bkp
drwxrwxr-x  2 vic vic    4096 May 19 16:14 introduction/
drwxrwxr-x  4 vic vic    4096 May 19 16:14 kubewarden/
lrwxrwxrwx  1 vic vic      17 May 19 16:14 latest -> kubewarden/latest/
drwxrwxr-x  2 vic vic    4096 May 19 16:14 organization/
drwxrwxr-x  2 vic vic    4096 May 19 16:14 personas/
drwxrwxr-x  2 vic vic    4096 May 19 16:14 quick-start/
drwxrwxr-x 17 vic vic    4096 May 19 16:14 reference/
drwxrwxr-x  4 vic vic    4096 May 19 16:14 sboms/
-rw-rw-r--  1 vic vic 1995489 May 19 16:14 search-index.js
-rw-rw-r--  1 vic vic  180158 May 19 16:14 sitemap-admc.xml
-rw-rw-r--  1 vic vic     241 May 19 16:14 sitemap-kubewarden.xml
-rw-rw-r--  1 vic vic    1494 May 19 16:14 sitemap-sboms.xml
-rw-rw-r--  1 vic vic     357 May 19 16:14 sitemap.xml
drwxrwxr-x  6 vic vic    4096 May 19 16:14 tutorials/
drwxrwxr-x  2 vic vic    4096 May 19 16:14 use-cases/

This means that we cannot re-use a path like build-local-community/site/howtos or build-local-community/site/introduction, but that's always the case with redirects.

Tradeoff

Potential improvement

Checklist

viccuad added 2 commits May 19, 2026 16:19
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>
@netlify
Copy link
Copy Markdown

netlify Bot commented May 19, 2026

Deploy Preview for docs-kubewarden-io ready!

Name Link
🔨 Latest commit 20c6107
🔍 Latest deploy log https://app.netlify.com/projects/docs-kubewarden-io/deploys/6a0c70f4540f320008abc67c
😎 Deploy Preview https://deploy-preview-756--docs-kubewarden-io.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@viccuad
Copy link
Copy Markdown
Member Author

viccuad commented May 19, 2026

@netlify
Copy link
Copy Markdown

netlify Bot commented May 19, 2026

Deploy Preview for docs-kubewarden-io ready!

Name Link
🔨 Latest commit 6aef505
🔍 Latest deploy log https://app.netlify.com/projects/docs-kubewarden-io/deploys/6a0c711c6a3df00008488eaa
😎 Deploy Preview https://deploy-preview-756--docs-kubewarden-io.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@viccuad viccuad self-assigned this May 19, 2026
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.html redirect files for legacy paths based on Antora page sources.
  • Wired redirect generation into the community-local and community-remote Makefile 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 thread Makefile
Comment on lines +37 to +40
./scripts/generate-redirects.sh \
docs/admc/version-1.35/modules/en/pages \
build/site \
/admc/1.35/en
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Pending review

Development

Successfully merging this pull request may close these issues.

3 participants