Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

PavelVanecek
Copy link
Collaborator

@PavelVanecek PavelVanecek commented Oct 22, 2025

Description

Website only.

Couple of things happened here:

  1. I noticed that google doesn't index anything, at all. This is because the 404 SPA hack we're using worked in 2016 but stopped working in 2019 and it's even documented: https://github.com/rafgraph/spa-github-pages?tab=readme-ov-file#seo
  2. Github Pages don't support proper SPA setup (render the same file on every route) and don't support SSR so those are not options.
  3. We could either change the provider, change the URL, or change how we generate HTML
  4. I figured that SSG (static site generation) would be fun so let's try that. I tried React router, couldn't get it to compile. I tried Vike, got scared by pricing. So I asked AI to write a custom one. Turns out that it's quite simple.
  5. I have also added a script that cross-validates the HTML files with sitemap
  6. I have also added new CI script to deploy the pages to another URL. Just for checking things
  7. Also I have found that we have three routes that don't render anything, only redirect. Google doesn't like that and react router doesn't like that either. And neither do I so I removed the root redirect (it just renders index now, as it should) and I added new Example index page and now that renders instead of redirect.

@PavelVanecek PavelVanecek requested a review from Copilot October 22, 2025 13:31
Copy link
Contributor

@Copilot 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 implements Static Site Generation (SSG) to resolve SEO issues with Google's searchbot by pre-rendering all routes at build time. The previous SPA GitHub Pages hack (from 2016) stopped working in 2019 and was causing all pages to return 404 status codes, preventing indexing.

Key changes:

  • Replaced the SPA 404 redirect hack with proper SSG using React's renderToString and hydrateRoot
  • Added automated sitemap validation to ensure consistency between generated HTML files and sitemap entries
  • Created an Examples index page with category previews to replace redirect-only routes

Reviewed Changes

Copilot reviewed 21 out of 22 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
www/src/entry-server.tsx New SSR entry point that renders routes to HTML and exports all routes for pre-rendering
www/scripts/prerender.tsx Build script that pre-renders all 378 routes to static HTML files
www/scripts/validate-sitemap.tsx Validation script ensuring sitemap URLs match generated HTML files
www/src/app.tsx Changed from createRoot to hydrateRoot for SSR hydration
www/src/views/ExamplesIndexView.tsx New landing page displaying example categories with preview cards
www/src/routes/index.tsx Removed redirect routes, added proper Examples index route
www/vite.config.ts Updated sitemap configuration to include explicit locale prefixes
www/public/404.html Replaced redirect hack with proper 404 page
www/index.html Removed SPA GitHub Pages redirect script
.github/workflows/deploy-staging.yml New workflow for staging deployments
Files not reviewed (1)
  • www/package-lock.json: Language not supported
Comments suppressed due to low confidence (1)

www/src/routes/index.tsx:17

  • The optional parameter /:name? allows matching routes without the name segment, but there's no index view defined for the API route. This means accessing /:locale/api will render APIView with undefined name, which may not be the intended behavior. Consider either making the name parameter required (:name) or adding a separate route for the API index page similar to how ExamplesIndexView was added for examples.
        path="/:locale/api/:name?"

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@codecov
Copy link

codecov bot commented Oct 22, 2025

Codecov Report

❌ Patch coverage is 5.88235% with 80 lines in your changes missing coverage. Please review.
✅ Project coverage is 93.48%. Comparing base (434a054) to head (b945984).

Files with missing lines Patch % Lines
www/src/views/ExamplesIndexView.tsx 0.00% 44 Missing and 1 partial ⚠️
www/src/entry-server.tsx 0.00% 20 Missing and 1 partial ⚠️
www/src/routes/index.tsx 0.00% 9 Missing and 1 partial ⚠️
www/src/app.tsx 0.00% 2 Missing and 1 partial ⚠️
www/src/views/index.ts 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6495      +/-   ##
==========================================
- Coverage   93.64%   93.48%   -0.17%     
==========================================
  Files         429      431       +2     
  Lines       39021    39090      +69     
  Branches     4531     4533       +2     
==========================================
+ Hits        36540    36542       +2     
- Misses       2466     2531      +65     
- Partials       15       17       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@codecov
Copy link

codecov bot commented Oct 22, 2025

Bundle Report

Bundle size has no change ✅

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.

1 participant