DEV Community

milo0914
milo0914

Posted on

How I Made Google Read My No-Routing SPA (Without a Framework)

How I Made Google Read My No-Routing SPA (Without a Framework)

My side project, Sniper English, is a free TOEIC vocabulary and listening game. It is a single-page app: one screen, no router, no /game or /blog views in App.tsx. The game itself works fine that way. Google did not.

A site: search returned zero results. The site had content — TOEIC study guides I had written — but every URL returned the same index.html through the SPA fallback. A crawler asking for /blog/toeic-part5-grammar-tips got the game shell, not the article. Google indexed nothing, because as far as it could tell, there was nothing to index.

Here is the fix I built. It is deliberately boring: no framework, no prerendering service, no new infrastructure. Just real files at real URLs.

1. Prerender the content as real HTML files

The core decision was to stop asking the SPA to be the content. Each guide is now a static HTML file generated by a small Node script, one generator per page. The generator holds the article as Markdown, renders it with marked, wraps it in a page template, and writes the result to disk:

// generate_part6.cjs — one generator per page
fs.mkdirSync('public/blog/toeic-part6-text-completion', { recursive: true });
fs.writeFileSync('public/blog/toeic-part6-text-completion/index.html', fullHtml);
Enter fullscreen mode Exit fullscreen mode

That is the whole trick. public/blog/toeic-part6-text-completion/index.html is a real file, so the server returns the article itself — with a 200 status and its own content — instead of falling back to the game. The SPA fallback still exists, but only for paths that genuinely have no file.

There are now 14 content pages built this way: five TOEIC Part guides (Parts 1, 2, 4, 6, 7), Part 3 and Part 5, a TOEIC 860 vocabulary list, a business English top 100, and several study-method guides. The game itself is untouched — same single screen, same login, same scoring. The articles live next to it, not inside it.

2. Give every page its own metadata

A file at a URL is not enough; it also has to look like a page. Each generated page carries its own <title>, meta description, canonical link, and Open Graph tags, plus structured data: Article and FAQPage JSON-LD on the content pages, and Organization on the homepage with a stable @id and only sameAs links I could actually verify.

This is where I had to clean house. The homepage's structured data used to list social profiles I could not verify as mine, and some translations described features the game does not have — "real human voice" for what is actually Web Speech API synthesis, a "massive word database" for what is actually 60 built-in words with AI-generated top-ups. I removed the unverified links and fixed the claims in all eight languages before shipping the new pages. If the crawler is going to read the pages, the pages should be true.

3. One source of truth for the sitemap

The sitemap is generated from a single REAL_PAGES list in update_sitemap.cjs, and the generator rewrites public/sitemap.xml from scratch on every run — it never appends, so re-running it cannot duplicate entries. The rule for the list is strict: a URL goes in only after its real static page exists under public/. The same list feeds the RSS feed, and robots.txt points at the sitemap.

That discipline matters because the old sitemap listed URLs that all returned the homepage — the classic soft-404 trap. Seventeen URLs are listed now: the homepage, the 14 content pages, and the privacy and terms pages. Every one of them returns its own content. I verified that in a browser, not just with a fetch, because a text fetch can return a stale cache and lie to you.

4. Measure whether anyone arrives

I added GA4 with game events (level_start, level_up, post_score, login, plus sign_up and share now that those features exist) and a play_from_article event on every content page's play button, so I can see whether readers actually become players. The point of the whole exercise is traffic that plays the game, not a green checkmark in Search Console.

The honest numbers so far

This is a progress report, not a victory lap. Google re-crawled the sitemap on November 20 and discovered all 17 pages. But only 3 of them are indexed so far. Discovery is not indexing, and I am not going to pretend the job is done.

What I know after one week:

  • The sitemap was read the same day it was submitted. The plumbing works.
  • Search traffic is still zero clicks. The seven-day Search Console window shows 0 clicks and 2 impressions.
  • The two users in GA4 that week were almost certainly me, testing the deploy.

Indexing takes weeks, and the honest expectation is that it stays quiet for a while. What changed is that there is now something real for Google to index, and a way to measure it when it happens.

What I deliberately did not do

A few things the SEO advice industry wanted me to buy or build:

  • No llms.txt expansion. Google has said it neither helps nor harms search. I keep the small file I already had and invest nothing more.
  • No FAQ rich-result chasing. Google dropped FAQ rich results. The FAQ structure stays because it helps readers and AI answers, not because it buys a SERP feature.
  • No /en/ version with hreflang. The game UI is translated into eight languages, but the articles are Traditional Chinese. A translated URL with no translated content behind it is worse than no URL.
  • No bought links, no invented claims. The articles say plainly what the game does not have — no mock test, no spaced repetition, no wrong-answer notebook — because a visitor who arrives on a false promise leaves and never comes back.

The pattern that worked for me: make the content real files, make the metadata true, list only what exists, and wait. It is slow, and that is the point. If you are fighting the same no-routing SPA problem, start with one page done properly and check it returns its own content in a real browser. Then do the next one.

One of the generated pages, the newest in the pipeline — and the game behind it, free to play: https://sniper-english.ai.studio/blog/toeic-part6-text-completion

Top comments (0)