NiceDay

One URL per page: cleaning up indexing on a multilingual game site

Slow Beads is available in Chinese, English, Japanese and Korean, and with the pattern library on top, its sitemap lists 323 URLs. When a site is tiny, duplicate URLs barely register. Once it grows, search engines start guessing which version is the real one, and they don't always guess right. Here's what I cleaned up.

Bare language paths: send them somewhere with content

/ja, /ko and /zh have no content of their own. They now 301 (with or without a trailing slash) to /{lang}/patterns/, keeping the query string. The same paths on the apex domain jump straight to the game subdomain, in a single hop.

One gotcha: these paths have to be listed in the assets config's run_worker_first. Otherwise the static assets layer answers first and the redirect code in the Worker never even sees the request.

// wrangler.jsonc (excerpt)
"assets": {
  "directory": "./public",
  "run_worker_first": ["/", "/ja", "/ja/", "/ko", "/ko/", "/zh", "/zh/", "/home", "/home/", "/sitemap.xml"]
}

/home: a screen isn't a page

The game has a screen called home, and the analytics code was reporting it as the path /home. A piece of UI state had turned into a "page". The fix took two steps: /home now 301s to /, and analytics reports the home screen's page_path as /.

Sitemap lastmod: don't touch it unless the content changed

The generator used to stamp every URL's lastmod with the build date. That's like telling search engines "everything changes every day", which teaches them to ignore the field entirely. It also meant the same source produced a different build every day.

Now the script keeps a lastmod.json with each page's content SHA-256 and date, and reuses the old date when the hash hasn't changed:

# tools/seo/gen.py (simplified)
digest = content_hash(page_content)
old = previous.get(u)
lastmod = old['date'] if old and old['hash'] == digest else TODAY
current[u] = {'hash': digest, 'date': lastmod}

Checking it was easy: two builds in a row produce byte-identical output, 323 entries each. After editing a game file, only / gets a new lastmod; the other 322 stay put.

Canonicals: use absolute URLs

Search Console had flagged pages as "Duplicate without user-selected canonical". The fix was to add an absolute canonical URL to the legal page template.

I deliberately didn't 301 URLs with parameters like ?lang=, because the in-page language switcher depends on them. The five pages on the apex domain get the same treatment: trailing-slash, .html and parameterized variants still return 200, but they all declare the same canonical.

Update, 2026-11-26: the apex-domain /ja and /ko no longer jump to the game subdomain. niceday-app.com is now a four-language site, and those two paths are its Japanese and Korean homepages. /zh on the apex still goes to the game's Chinese pattern pages, and the game site's own /ja, /ko and /zh work exactly as described above.