feat(redirects): add script to generate HTML meta-refresh stubs for v1 to v2 migration#1573
Merged
Merged
Conversation
…1 to v2 migration
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the docs deployment pipeline to generate HTML meta-refresh redirect stubs so legacy v1 documentation URLs (e.g., /en/harness/overview.html) continue to work after the v1→v2 docs path migration, and makes small copy edits in v2 docs.
Changes:
- Add
docs/scripts/generate_v1_redirects.pyto generate legacy-path redirect HTML stubs pointing to the new/v1/...paths. - Wire the redirect generation into the GitHub Pages workflow after the Jupyter Book build.
- Minor wording updates in v2 English intro/docs pages; adjust docs
pyproject.tomlpackaging shim configuration.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
docs/v2/en/intro.md |
Updates Harness marketing copy (“bedrock” → “scaffolding”). |
docs/v2/en/docs/index.md |
Updates Harness marketing copy (“bedrock” → “scaffolding”). |
docs/scripts/generate_v1_redirects.py |
Adds a redirect-stub generator for legacy v1 URL compatibility. |
docs/pyproject.toml |
Updates docs toolchain install shim config and readme path. |
.github/workflows/website.yml |
Runs redirect-stub generation step between build and deploy. |
Comment on lines
+51
to
+65
| STUB_TEMPLATE = """<!doctype html> | ||
| <html lang="{lang}"> | ||
| <head> | ||
| <meta charset="utf-8"> | ||
| <title>Redirecting…</title> | ||
| <link rel="canonical" href="{canonical}"> | ||
| <meta http-equiv="refresh" content="0; url={target}"> | ||
| <script>location.replace({target_json});</script> | ||
| <style>body{{font-family:system-ui,sans-serif;max-width:32em;margin:4em auto;padding:0 1em;color:#444}}</style> | ||
| </head> | ||
| <body> | ||
| <p>This page has moved. Redirecting to <a href="{target}">{target}</a>…</p> | ||
| </body> | ||
| </html> | ||
| """ |
Comment on lines
+163
to
+166
| if out_path.exists(): | ||
| # Never clobber a real page that the build actually produced. | ||
| skipped_existing += 1 | ||
| continue |
Comment on lines
+106
to
+116
| def render_stub(lang: str, root_relative_target: str, site_base: str) -> str: | ||
| canonical = (site_base.rstrip("/") + root_relative_target) if site_base else root_relative_target | ||
| # JSON-encode for embedding in JS so any future special chars survive | ||
| import json | ||
|
|
||
| return STUB_TEMPLATE.format( | ||
| lang=lang, | ||
| target=root_relative_target, | ||
| target_json=json.dumps(root_relative_target), | ||
| canonical=canonical, | ||
| ) |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
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.
No description provided.