Fix: generate the docs in the CI instead of a index.html to avoid double redirect#336
Conversation
…ble redirect Signed-off-by: Jiaxiao Zhou <duibao55328@gmail.com>
There was a problem hiding this comment.
Pull Request Overview
This PR modifies the documentation build process to generate the root redirect page dynamically in CI rather than storing it as a static file, preventing potential double redirects in the local development environment.
Key changes:
- Remove static
docs/index.htmlredirect file - Generate redirect page inline during CI build process
- Add documentation explaining local vs production URL structure differences
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| docs/index.html | Removes static redirect HTML file that was causing local development issues |
| .github/workflows/docs.yml | Replaces file copy with inline HTML generation for the root redirect page |
| .github/instructions/docs.instructions.md | Adds clarification about URL structure differences between local and production environments |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| cat > public/wassette/index.html << 'EOF' | ||
| <!DOCTYPE html> | ||
| <html lang="en"> | ||
| <head> | ||
| <meta charset="UTF-8"> | ||
| <meta http-equiv="refresh" content="0; url=latest/"> | ||
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
| <title>Redirecting to Wassette Documentation</title> | ||
| <style> | ||
| body { | ||
| font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; | ||
| display: flex; | ||
| justify-content: center; | ||
| align-items: center; | ||
| height: 100vh; | ||
| margin: 0; | ||
| background-color: #f5f5f5; | ||
| } | ||
| .message { | ||
| text-align: center; | ||
| padding: 2rem; | ||
| background: white; | ||
| border-radius: 8px; | ||
| box-shadow: 0 2px 10px rgba(0,0,0,0.1); | ||
| } | ||
| a { | ||
| color: #4183c4; | ||
| text-decoration: none; | ||
| } | ||
| a:hover { | ||
| text-decoration: underline; | ||
| } | ||
| </style> | ||
| </head> | ||
| <body> | ||
| <div class="message"> | ||
| <h1>Redirecting to Wassette Documentation</h1> | ||
| <p>If you are not redirected automatically, <a href="latest/">click here</a>.</p> | ||
| </div> | ||
| </body> | ||
| </html> | ||
| EOF |
There was a problem hiding this comment.
[nitpick] Using heredoc syntax in CI scripts can be fragile and difficult to maintain. Consider creating a template file or using a dedicated build script that can be version controlled and tested separately.
| cat > public/wassette/index.html << 'EOF' | |
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta http-equiv="refresh" content="0; url=latest/"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>Redirecting to Wassette Documentation</title> | |
| <style> | |
| body { | |
| font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; | |
| display: flex; | |
| justify-content: center; | |
| align-items: center; | |
| height: 100vh; | |
| margin: 0; | |
| background-color: #f5f5f5; | |
| } | |
| .message { | |
| text-align: center; | |
| padding: 2rem; | |
| background: white; | |
| border-radius: 8px; | |
| box-shadow: 0 2px 10px rgba(0,0,0,0.1); | |
| } | |
| a { | |
| color: #4183c4; | |
| text-decoration: none; | |
| } | |
| a:hover { | |
| text-decoration: underline; | |
| } | |
| </style> | |
| </head> | |
| <body> | |
| <div class="message"> | |
| <h1>Redirecting to Wassette Documentation</h1> | |
| <p>If you are not redirected automatically, <a href="latest/">click here</a>.</p> | |
| </div> | |
| </body> | |
| </html> | |
| EOF | |
| cp docs/gh-pages-root-index.html public/wassette/index.html |
| cat > public/wassette/index.html << 'EOF' | ||
| <!DOCTYPE html> | ||
| <html lang="en"> | ||
| <head> | ||
| <meta charset="UTF-8"> | ||
| <meta http-equiv="refresh" content="0; url=latest/"> | ||
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
| <title>Redirecting to Wassette Documentation</title> | ||
| <style> | ||
| body { | ||
| font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; | ||
| display: flex; | ||
| justify-content: center; | ||
| align-items: center; | ||
| height: 100vh; | ||
| margin: 0; | ||
| background-color: #f5f5f5; | ||
| } | ||
| .message { | ||
| text-align: center; | ||
| padding: 2rem; | ||
| background: white; | ||
| border-radius: 8px; | ||
| box-shadow: 0 2px 10px rgba(0,0,0,0.1); | ||
| } | ||
| a { | ||
| color: #4183c4; | ||
| text-decoration: none; | ||
| } | ||
| a:hover { | ||
| text-decoration: underline; | ||
| } | ||
| </style> | ||
| </head> | ||
| <body> | ||
| <div class="message"> | ||
| <h1>Redirecting to Wassette Documentation</h1> | ||
| <p>If you are not redirected automatically, <a href="latest/">click here</a>.</p> | ||
| </div> | ||
| </body> | ||
| </html> | ||
| EOF |
There was a problem hiding this comment.
[nitpick] This large inline HTML block makes the workflow file difficult to read and maintain. Consider moving the HTML content to a separate template file that can be processed during the build, which would also allow for easier testing and validation of the HTML.
No description provided.