fix(index-builder): add _redirects to route / → app.html
The replay viewer was baked into index.html (served at /) while the leaderboard app was at /app.html. Add a _redirects file so visitors landing on / get redirected to the main leaderboard app. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
992fa1d573
commit
5d89fbd885
1 changed files with 10 additions and 0 deletions
|
|
@ -107,6 +107,16 @@ func verifyMergedOutput(cfg *Config) error {
|
|||
slog.Warn("leaderboard.json not yet generated, deploying with partial data")
|
||||
}
|
||||
|
||||
// Ensure _redirects routes / → app.html so the main leaderboard app is the
|
||||
// entry point. The replay viewer stays at /index.html for direct linking.
|
||||
redirectsPath := filepath.Join(cfg.OutputDir, "_redirects")
|
||||
if _, err := os.Stat(redirectsPath); err != nil {
|
||||
redirectsContent := "/ /app.html 301\n"
|
||||
if writeErr := os.WriteFile(redirectsPath, []byte(redirectsContent), 0644); writeErr != nil {
|
||||
slog.Warn("Failed to write _redirects", "error", writeErr)
|
||||
}
|
||||
}
|
||||
|
||||
slog.Info("Merged output verified", "directory", cfg.OutputDir)
|
||||
return nil
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue