Skip to content

Add custom 404 smart router page#12

Open
claude[bot] wants to merge 1 commit intomainfrom
claude/issue-11-20260303-1930
Open

Add custom 404 smart router page#12
claude[bot] wants to merge 1 commit intomainfrom
claude/issue-11-20260303-1930

Conversation

@claude
Copy link

@claude claude bot commented Mar 3, 2026

Summary

  • Adds generate404() to generate-index.go that builds site/404.html at build time, embedding all known repo names as a JSON array
  • The 404 page's JS reads the URL path segment and redirects to /{repo}/ if it's a known repo, otherwise shows a branded landing page
  • Generate Docs button pre-fills a GitHub issue [Repo Request] {repo} (with @claude in the body to auto-trigger)
  • XSS prevented throughout: textContent for display, encodeURIComponent for URL construction — no innerHTML usage
  • Mobile responsive, matches existing visual style and color scheme
  • noscript fallback makes content visible without JavaScript

Test plan

  • Visit repos.supermodeltools.com/react → should redirect to /react/
  • Visit repos.supermodeltools.com/unknown-repo → should show branded landing page with "Generate Docs" button
  • Click Generate Docs → opens GitHub issue with pre-filled [Repo Request] unknown-repo title
  • Verify no XSS: visit path with script tag → should display safely as text
  • Check mobile at 375px viewport

Closes #11

Generated with Claude Code

- generate404() embeds known repo names as JSON in 404.html
- JS reads URL path and redirects to /{repo}/ if slug is a known repo
- Unknown slugs show a branded "Generate Docs" landing page
- Generate button pre-fills a GitHub issue: [Repo Request] {repo}
- XSS prevented: textContent for display, encodeURIComponent for URLs
- Mobile responsive, matches existing visual style
- Updates generate-index.go to output site/404.html on each build

Co-authored-by: Jonathan Popham <jonathanpopham@users.noreply.github.com>
Co-Authored-By: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add custom 404 page as smart router for repo URLs

0 participants