Skip to content

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

Merged
flavio merged 2 commits into
kubewarden:mainfrom
viccuad:feat/static-redirects
May 26, 2026
Merged

feat: generate static HTML redirect files for old Docusaurus URLs#756
flavio merged 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

@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 2968f4a
🔍 Latest deploy log https://app.netlify.com/projects/docs-kubewarden-io/deploys/6a157236bc52fe00083f276c
😎 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 thread scripts/generate-redirects.sh Outdated
Comment thread Makefile Outdated
Comment on lines +37 to +40
./scripts/generate-redirects.sh \
docs/admc/version-1.35/modules/en/pages \
build/site \
/admc/1.35/en
@jhkrug
Copy link
Copy Markdown
Contributor

jhkrug commented May 20, 2026

Ok, having checked, nobody minds (docs team)that we do this. So, i guess we need to look at the Copilot suggestion and some testing, then all good.

@viccuad have I got this right. This runs, it will always generate the same set of links, always to 1.35. So frozen in time?

@viccuad
Copy link
Copy Markdown
Member Author

viccuad commented May 21, 2026

@viccuad have I got this right. This runs, it will always generate the same set of links, always to 1.35. So frozen in time?

Yes, that's the idea, old links will always point to 1.35.

I will tackle the Copilot suggestions.

@viccuad viccuad moved this from Pending review to In Progress in Kubewarden Admission Controller May 21, 2026
@viccuad viccuad force-pushed the feat/static-redirects branch from e32b737 to 305178a Compare May 21, 2026 14:21
@viccuad
Copy link
Copy Markdown
Member Author

viccuad commented May 21, 2026

rebased on top of main to obtain the new community-remote-netlify target, and added the redirect generation also there.

@viccuad viccuad moved this from In Progress to Pending review in Kubewarden Admission Controller May 21, 2026
Copy link
Copy Markdown
Contributor

@jhkrug jhkrug left a comment

Choose a reason for hiding this comment

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

lgtm

@viccuad viccuad moved this from Pending review to Blocked in Kubewarden Admission Controller May 22, 2026
@viccuad
Copy link
Copy Markdown
Member Author

viccuad commented May 22, 2026

Blocked on #761.

Signed-off-by: Víctor Cuadrado Juan <vcuadradojuan@suse.de>
@viccuad viccuad force-pushed the feat/static-redirects branch from 305178a to 2968f4a Compare May 26, 2026 10:13
@viccuad
Copy link
Copy Markdown
Member Author

viccuad commented May 26, 2026

Rebased on top of main, ready to review again.

@viccuad viccuad moved this from In Progress to Pending review in Kubewarden Admission Controller May 26, 2026
@viccuad viccuad requested a review from jhkrug May 26, 2026 10:13
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 build targets so GitHub Pages serves the redirects without
needing server-side configuration.

Signed-off-by: Víctor Cuadrado Juan <vcuadradojuan@suse.de>
@flavio flavio merged commit 64dddec into kubewarden:main May 26, 2026
6 checks passed
@github-project-automation github-project-automation Bot moved this from Pending review to Done in Kubewarden Admission Controller May 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

5 participants