Skip to content

Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.

fix(i18n): hreflang alternates were missing for 160 translated pages

nirholas497d3549778b
diff --git a/CHANGELOG.md b/CHANGELOG.md
index c0ca76303..a57896558 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -14,6 +14,8 @@ Public history for [three.ws](https://three.ws), newest first. New pages come fr
- **Garment generation no longer loses jobs when it scales down** — Requesting a batch of garments could silently drop most of them: the queue lived in one server's memory, so anything waiting disappeared when that server was recycled. Jobs are now durable and picked up by whichever server is free, with automatic retries, so a queued piece finishes even if the machine that took the request goes away. `[fix, infra]`
- **Generated garments are checked for shape, not just fit** — A garment can be skinned perfectly and still be the wrong shape: one generated hairstyle came back as a curtain nearly as tall as the avatar wearing it. Pieces are now measured against the body at two points, when they are made and again when they are worn, so a malformed mesh is refused and regenerated instead of ending up on someone's avatar. `[fix, improvement]`
- **Hats and shoes now sit where they belong** — Generated caps could come out with brims jutting past the face, and sneakers could hover away from the feet, because the forge sized those pieces by width alone: a deep-brimmed cap or a photographed pair of shoes standing close together gave the sizing step no useful signal. Caps are now scaled to fit the head on every dimension, and shoes are sized by foot length and placed onto each foot individually. Measured on a walking avatar, the worst-case gap between shoe and foot dropped from 34cm to 3cm, and cap overhang from 21cm to 8cm. Every piece in the catalog is now checked automatically: it must load, match its published fingerprint, and bind correctly onto four different avatar skeletons before it counts as good, with the pieces that failed the new bar replaced. A daily check also watches the live catalog for anything that breaks after the fact. `[improvement, fix]`
+- **Pages that stayed English no matter which language you picked now translate** — Switching the site to one of our 50 languages left a set of pages stubbornly in English, and for three different reasons. Every news post was one of them: the translations existed, in every language, but the news pages are rebuilt automatically and each rebuild dropped the markers that connect a page to its translations, so about 2,400 already-translated strings sat unused. The cookbook lost its markers the same way when the page was rewritten. And ten pages had never been connected at all, including the wardrobe and our OpenAI partner page. All of them are wired now, the news rebuild reconnects itself so it cannot drift again, and the copy that was genuinely never translated is being translated into every language. `[fix, improvement]`
+- **Search engines can now find the translated version of 160 more pages** — We tell search engines which languages a page is available in so someone searching in Japanese finds the Japanese version rather than the English one. The list of pages that got those signals was built by guessing each page's file from its address, and the guess only covered one of the four layouts we actually use. Pages living in a subfolder were treated as having no translations at all, so 160 fully translated pages, including the cookbook, the gallery, the demos and our OpenAI partner page, were telling search engines they existed only in English. Coverage goes from 186 pages to 346. `[fix, improvement]`
- **Solana name registration works again, and embeds stop crashing on older phones** — Claiming a .sol domain for an agent, and claiming your own name under threews.sol, both ran against a Solana naming library so old that the functions doing the registering had been renamed out from under us: the calls resolved to nothing and the whole attempt failed. The library is now current, every naming path has been re-checked against the live Solana mainnet, and handing a fresh subdomain to its new owner no longer trips over an account that the same transaction is still creating. Looking up a wallet's primary name also stops reporting a name the wallet no longer owns. Separately, the embeddable 3D avatar used a newer JavaScript feature than some older Android browsers ship, so the avatar page went blank instead of loading; the missing piece is now included in the embed, which matters because the embed is designed to run on other people's sites where we do not get to pick the browser. (`/embed`) `[fix]`
- **The 3D forge accepts all six reference photos again** — The photo composer advertised six reference views but only built four slots, so filling the last one threw an error and stopped the upload. All six slots are now real and usable, which is the full set the generator accepts, and more views produce a sharper mesh. Text prompts also retry once when the concept-image step returns an empty result, instead of falling back to a lower-quality image lane. (`/forge`) `[fix, improvement]`
- **The walkaround world now has a real time of day and /play's radar** — Walk your avatar into the park at dusk and it actually looks like dusk. The sun rises, arcs overhead and sets, the sky graduates from night through dawn to day, and the lights and reflections follow it, all driven by the same shared world clock the coin worlds run on, so everyone standing in the same world sees the same sky at the same moment. Indoor stages keep their authored lighting and the cycle steps aside while the camera passthrough is on. The corner map was also replaced with the rotating radar from the coin worlds: it turns under a fixed player arrow, keeps a compass and the world boundary in view, and now shows other players in their nameplate colours alongside companions, live agent desks, the named landmarks your guide walks to, and the scenery around you. Click or tap the radar to send your avatar walking there. Press M to hide or show it and it remembers your choice. The walkaround also picked up the shared frame governor: it now renders at 60fps while you are playing, eases to 30 when you click away to another window, and holds 30 with Power saver on, which is a new switch in the controls panel (press H) that carries over from the coin worlds and the club. Fixing that panel turned up an older problem: none of its switches could actually be clicked, because the panel let every click fall through to the world behind it. Haptics, path trail and NPC companions work again too. (`/temporary`) `[feature, improvement]`
diff --git a/data/changelog.json b/data/changelog.json
index c31abc21f..a61307b56 100644
--- a/data/changelog.json
+++ b/data/changelog.json
@@ -1,6 +1,24 @@
{
"$comment": "Curated changelog entries for three.ws, the editorial layer of the public changelog. New PAGE launches are tracked automatically via the `added` field in data/pages.json; this file is for everything else holders care about: improvements, fixes, SDK releases, trading/payments capabilities, security work. scripts/build-page-index.mjs merges both sources into CHANGELOG.md, public/changelog.json, and public/changelog.xml. Newest first. Allowed tags: feature, improvement, fix, sdk, infra, docs, security. `link` is optional and must be a live three.ws path.",
"entries": [
+ {
+ "date": "2026-07-27",
+ "title": "Search engines can now find the translated version of 160 more pages",
+ "summary": "We tell search engines which languages a page is available in so someone searching in Japanese finds the Japanese version rather than the English one. The list of pages that got those signals was built by guessing each page's file from its address, and the guess only covered one of the four layouts we actually use. Pages living in a subfolder were treated as having no translations at all, so 160 fully translated pages, including the cookbook, the gallery, the demos and our OpenAI partner page, were telling search engines they existed only in English. Coverage goes from 186 pages to 346.",
+ "tags": [
+ "fix",
+ "improvement"
+ ]
+ },
+ {
+ "date": "2026-07-27",
+ "title": "Pages that stayed English no matter which language you picked now translate",
+ "summary": "Switching the site to one of our 50 languages left a set of pages stubbornly in English, and for three different reasons. Every news post was one of them: the translations existed, in every language, but the news pages are rebuilt automatically and each rebuild dropped the markers that connect a page to its translations, so about 2,400 already-translated strings sat unused. The cookbook lost its markers the same way when the page was rewritten. And ten pages had never been connected at all, including the wardrobe and our OpenAI partner page. All of them are wired now, the news rebuild reconnects itself so it cannot drift again, and the copy that was genuinely never translated is being translated into every language.",
+ "tags": [
+ "fix",
+ "improvement"
+ ]
+ },
{
"date": "2026-07-27",
"title": "Translated pages no longer turn code samples into live 3D avatars",
diff --git a/public/changelog.json b/public/changelog.json
index a0dff9706..a7cd0275a 100644
--- a/public/changelog.json
+++ b/public/changelog.json
@@ -1,5 +1,5 @@
{
- "generated_at": "2026-07-27T20:59:24.845Z",
+ "generated_at": "2026-07-27T21:22:38.740Z",
"generated_by": "scripts/build-page-index.mjs from data/pages.json + data/changelog.json",
"site": {
"name": "three.ws",
@@ -93,6 +93,28 @@
"fix"
]
},
+ {
+ "date": "2026-07-27",
+ "type": "update",
+ "title": "Pages that stayed English no matter which language you picked now translate",
+ "summary": "Switching the site to one of our 50 languages left a set of pages stubbornly in English, and for three different reasons. Every news post was one of them: the translations existed, in every language, but the news pages are rebuilt automatically and each rebuild dropped the markers that connect a page to its translations, so about 2,400 already-translated strings sat unused. The cookbook lost its markers the same way when the page was rewritten. And ten pages had never been connected at all, including the wardrobe and our OpenAI partner page. All of them are wired now, the news rebuild reconnects itself so it cannot drift again, and the copy that was genuinely never translated is being translated into every language.",
+ "link": null,
+ "tags": [
+ "fix",
+ "improvement"
+ ]
+ },
+ {
+ "date": "2026-07-27",
+ "type": "update",
+ "title": "Search engines can now find the translated version of 160 more pages",
+ "summary": "We tell search engines which languages a page is available in so someone searching in Japanese finds the Japanese version rather than the English one. The list of pages that got those signals was built by guessing each page's file from its address, and the guess only covered one of the four layouts we actually use. Pages living in a subfolder were treated as having no translations at all, so 160 fully translated pages, including the cookbook, the gallery, the demos and our OpenAI partner page, were telling search engines they existed only in English. Coverage goes from 186 pages to 346.",
+ "link": null,
+ "tags": [
+ "fix",
+ "improvement"
+ ]
+ },
{
"date": "2026-07-27",
"type": "update",
diff --git a/public/changelog.xml b/public/changelog.xml
index 92910e866..b5abeb3fc 100644
--- a/public/changelog.xml
+++ b/public/changelog.xml
@@ -70,6 +70,22 @@
<category>improvement</category>
<description>Generated caps could come out with brims jutting past the face, and sneakers could hover away from the feet, because the forge sized those pieces by width alone: a deep-brimmed cap or a photographed pair of shoes standing close together gave the sizing step no useful signal. Caps are now scaled to fit the head on every dimension, and shoes are sized by foot length and placed onto each foot individually. Measured on a walking avatar, the worst-case gap between shoe and foot dropped from 34cm to 3cm, and cap overhang from 21cm to 8cm. Every piece in the catalog is now checked automatically: it must load, match its published fingerprint, and bind correctly onto four different avatar skeletons before it counts as good, with the pieces that failed the new bar replaced. A daily check also watches the live catalog for anything that breaks after the fact.</description>
</item>
+ <item>
+ <title>Pages that stayed English no matter which language you picked now translate</title>
+ <link>https://three.ws/changelog</link>
+ <guid isPermaLink="false">2026-07-27:Pages that stayed English no matter which language you picked now translate</guid>
+ <pubDate>Mon, 27 Jul 2026 12:00:00 GMT</pubDate>
+ <category>fix</category>
+ <description>Switching the site to one of our 50 languages left a set of pages stubbornly in English, and for three different reasons. Every news post was one of them: the translations existed, in every language, but the news pages are rebuilt automatically and each rebuild dropped the markers that connect a page to its translations, so about 2,400 already-translated strings sat unused. The cookbook lost its markers the same way when the page was rewritten. And ten pages had never been connected at all, including the wardrobe and our OpenAI partner page. All of them are wired now, the news rebuild reconnects itself so it cannot drift again, and the copy that was genuinely never translated is being translated into every language.</description>
+ </item>
+ <item>
+ <title>Search engines can now find the translated version of 160 more pages</title>
+ <link>https://three.ws/changelog</link>
+ <guid isPermaLink="false">2026-07-27:Search engines can now find the translated version of 160 more pages</guid>
+ <pubDate>Mon, 27 Jul 2026 12:00:00 GMT</pubDate>
+ <category>fix</category>
+ <description>We tell search engines which languages a page is available in so someone searching in Japanese finds the Japanese version rather than the English one. The list of pages that got those signals was built by guessing each page's file from its address, and the guess only covered one of the four layouts we actually use. Pages living in a subfolder were treated as having no translations at all, so 160 fully translated pages, including the cookbook, the gallery, the demos and our OpenAI partner page, were telling search engines they existed only in English. Coverage goes from 186 pages to 346.</description>
+ </item>
<item>
<title>Solana name registration works again, and embeds stop crashing on older phones</title>
<link>https://three.ws/embed</link>
diff --git a/public/locales/localized-pages.json b/public/locales/localized-pages.json
index 20791483b..1fe55ea27 100644
--- a/public/locales/localized-pages.json
+++ b/public/locales/localized-pages.json
@@ -1,8 +1,9 @@
{
"generated": true,
- "count": 186,
+ "count": 346,
"paths": [
"/",
+ "/3d",
"/activity",
"/admin/ring",
"/agenc/embodied",
@@ -15,6 +16,7 @@
"/agent-studio",
"/agent-trade",
"/agent-wallet",
+ "/agents",
"/agents-live",
"/agi",
"/agora",
@@ -22,7 +24,9 @@
"/animations",
"/app",
"/ar",
+ "/arbitrage",
"/arena",
+ "/artifact",
"/assistant",
"/autopilot",
"/autopilot-activity",
@@ -31,6 +35,8 @@
"/avatar-sdk",
"/avatar-studio",
"/avatar-wallet-chat",
+ "/aws",
+ "/bazaar",
"/bnb",
"/bnb-latency",
"/brain",
@@ -38,7 +44,9 @@
"/capture",
"/categories",
"/chains",
+ "/changelog",
"/character-library",
+ "/characters",
"/claim-wallet",
"/clash",
"/clip-director",
@@ -54,6 +62,7 @@
"/concierge",
"/constellation",
"/converter",
+ "/cookbook",
"/cosmos",
"/create",
"/create-agent",
@@ -65,13 +74,19 @@
"/dad",
"/daily",
"/daily-match",
+ "/dashboard",
"/defi",
+ "/demos",
"/deployments",
"/derivatives",
"/dex-volumes",
"/diorama",
+ "/discover",
+ "/docs/walk",
"/economy",
+ "/eth-vanity",
"/events/build-3d-agents-live",
+ "/evm-wallet",
"/exchanges",
"/fact-check",
"/fact-checker",
@@ -88,19 +103,25 @@
"/features/walk",
"/feed",
"/fees",
+ "/forever",
"/forge",
"/forge-nim",
"/forge-spark",
"/forge-studio",
+ "/forged",
+ "/forgot-password",
"/galaxy",
+ "/gallery",
"/gas",
"/genesis",
"/genome",
"/glossary",
+ "/gmgn",
"/guardian",
"/hacks",
"/heatmap",
"/hero-demo",
+ "/hydrate",
"/ibm/hello",
"/ibm/x402-demo",
"/integrations",
@@ -115,7 +136,15 @@
"/launches",
"/launchpad",
"/leaderboard",
+ "/legal",
+ "/legal/content-policy",
+ "/legal/eula",
+ "/legal/privacy",
+ "/legal/risk",
+ "/legal/tos",
"/live",
+ "/login",
+ "/lookup",
"/marketplace",
"/markets",
"/meta-allocator",
@@ -123,10 +152,123 @@
"/mirror",
"/mocap-studio",
"/motion-swap",
+ "/my-agents",
+ "/news",
+ "/news/",
+ "/news/2045242891350814835",
+ "/news/2049397875935989970",
+ "/news/2049406826719137937",
+ "/news/2049412062837928202",
+ "/news/2049447738434339171",
+ "/news/2049458671139336613",
+ "/news/2049476546285740512",
+ "/news/2049557523330638269",
+ "/news/2049573582247022869",
+ "/news/2049576603324411933",
+ "/news/2049576641127682430",
+ "/news/2049577291957899336",
+ "/news/2049762836881301865",
+ "/news/2049765915575914834",
+ "/news/2049997615421649363",
+ "/news/2050016695897706885",
+ "/news/2050049239301165535",
+ "/news/2050221269732425928",
+ "/news/2050226678321102975",
+ "/news/2050229144676675999",
+ "/news/2050284562069266616",
+ "/news/2050585585191186781",
+ "/news/2050627547394916768",
+ "/news/2050753406109880576",
+ "/news/2050758788186353723",
+ "/news/2050800140295049308",
+ "/news/2050886334261391686",
+ "/news/2051140736201175323",
+ "/news/2051261108506558901",
+ "/news/2051616708482498843",
+ "/news/2051689230997618690",
+ "/news/2051690803203105230",
+ "/news/2051774915876098063",
+ "/news/2051858035862335505",
+ "/news/2051858503523066283",
+ "/news/2051893054584553680",
+ "/news/2052037977556287723",
+ "/news/2052167399399735476",
+ "/news/2052181307002929363",
+ "/news/2052189491801284690",
+ "/news/2052402481024667887",
+ "/news/2052402580266098813",
+ "/news/2052418108837781511",
+ "/news/2052418482269254040",
+ "/news/2052426446073983267",
+ "/news/2052588973466484922",
+ "/news/2052603250524967045",
+ "/news/2052685648377913671",
+ "/news/2052790746256920583",
+ "/news/2052791935585407403",
+ "/news/2053025259645981078",
+ "/news/2053698115203743922",
+ "/news/2053698387263008827",
+ "/news/2053730856339144932",
+ "/news/2053801703355629587",
+ "/news/2053804700609458214",
+ "/news/2053832201176027583",
+ "/news/2054404663802483072",
+ "/news/2054675701132132736",
+ "/news/2055140064070717618",
+ "/news/2055307440921702738",
+ "/news/2055309846556401735",
+ "/news/2055310365588922872",
+ "/news/2055517252964024561",
+ "/news/2055967730495586477",
+ "/news/2055985494606106821",
+ "/news/2056556899403997450",
+ "/news/2057721370310775223",
+ "/news/2057780453709648200",
+ "/news/2057782522994684413",
+ "/news/2057786164862730704",
+ "/news/2058076885805085111",
+ "/news/2058287578227577039",
+ "/news/2059456289789657537",
+ "/news/2059456294189498830",
+ "/news/2059456295825223723",
+ "/news/2059457822941978723",
+ "/news/2059675892981633179",
+ "/news/2059712761622675776",
+ "/news/2059821472156446844",
+ "/news/2059894004771418220",
+ "/news/2060178868305326413",
+ "/news/2060186881636422038",
+ "/news/2061418285896269952",
+ "/news/2061488909264040194",
+ "/news/2061523804405616642",
+ "/news/2061713039624405062",
+ "/news/aws-builder-center-blog",
+ "/news/aws-marketplace-live-may29",
+ "/news/bybit-alpha-listing",
+ "/news/cmc-mcp-registry-article",
+ "/news/cmc-memecoin-3d-world",
+ "/news/ibm-collaboration-showcase",
+ "/news/ibm-showcase-may31",
+ "/news/joined-aws-partner-network",
+ "/news/listed-on-bnb-chain-dappbay",
+ "/news/live-on-alibaba-cloud-marketplace",
+ "/news/live-on-aws-marketplace",
+ "/news/mcp-servers-x402-bazaar-coinbase",
+ "/news/moonshot-verified",
+ "/news/partnered-with-hackernoon",
+ "/news/quicknode-startup-program",
+ "/news/text-to-3d-is-live",
+ "/news/three-ws-dextools-social-boost-buyback",
+ "/news/three-ws-featured-on-alibaba-cloud-marketplace-blog",
+ "/news/three-ws-first-month-3d-agent-layer",
+ "/news/threews-play-coin-communities",
"/nim-forge",
+ "/notifications",
"/objects",
+ "/openai",
"/oracle",
"/partners",
+ "/pay",
"/payments",
"/pipeline",
"/pitch",
@@ -139,22 +281,28 @@
"/pricing",
"/profile",
"/proof",
+ "/providers",
"/pulse",
"/pump-dashboard",
"/pump-live",
"/pump-visualizer",
+ "/pumpfun",
"/radar",
"/rankings",
+ "/register",
+ "/reputation",
"/restyle",
"/scan",
"/scene",
"/screener",
"/search",
+ "/settings",
"/shopper",
"/sign-language",
"/signals",
"/skills",
"/smart-money",
+ "/spatial-mcp",
"/sperax",
"/splat",
"/stablecoins",
@@ -162,6 +310,8 @@
"/start",
"/status",
"/strategies",
+ "/strategy-lab",
+ "/studio",
"/support",
"/swarms",
"/temporary",
@@ -176,17 +326,27 @@
"/tracker",
"/trades",
"/trending",
+ "/tutor",
"/tutorials",
"/unstoppable",
+ "/validation",
+ "/vanity-wallet",
+ "/vanity/bounties",
+ "/vanity/gallery",
+ "/vanity/premium",
+ "/vanity/verify",
"/vault",
"/vaults",
"/viability",
+ "/viewer",
"/voice",
"/walk-leaderboard",
+ "/wardrobe",
"/watchlist",
"/what-is",
"/world-lines",
"/x402-revenue",
+ "/x402/studio",
"/yields"
]
}
diff --git a/scripts/build-page-index.mjs b/scripts/build-page-index.mjs
index 43bbc36b0..c56248808 100644
--- a/scripts/build-page-index.mjs
+++ b/scripts/build-page-index.mjs
@@ -558,18 +558,36 @@ function writeIfChanged(file, content) {
// data-i18n annotation. The dynamic sitemap (api/sitemap/[type].js) reads this
// list to emit <xhtml:link hreflang> alternates for exactly those routes, so
// hreflang coverage tracks annotation automatically with no second list to keep
-// in sync. Path → file uses the same clean-URL convention the server serves
-// (/what-is → pages/what-is.html, / → pages/home.html).
+// in sync. Path → file uses the same clean-URL conventions the server serves.
+//
+// All four locations matter. Checking only pages/<slug>.html silently drops the
+// 49 annotated pages that live at pages/<slug>/index.html (/openai) or under
+// public/ (/cookbook, /gallery, /demos, /pay …): fully translated pages that
+// nonetheless told search engines they had no alternates.
+export function localizedPageFile(path, exists = existsSync, dir = root) {
+ if (!path || path.startsWith('http')) return null;
+ const slug = path === '/' ? 'home' : path.replace(/^\/+|\/+$/g, '');
+ for (const rel of [
+ `pages/${slug}.html`,
+ `pages/${slug}/index.html`,
+ `public/${slug}.html`,
+ `public/${slug}/index.html`,
+ ]) {
+ const file = resolve(dir, rel);
+ if (exists(file)) return file;
+ }
+ return null;
+}
+
function buildLocalizedPages() {
const paths = [];
for (const p of allPages) {
- if (!p.path || p.path.startsWith('http')) continue;
- const slug = p.path === '/' ? 'home' : p.path.replace(/^\/+|\/+$/g, '');
- const file = resolve(root, 'pages', `${slug}.html`);
+ const file = localizedPageFile(p.path);
+ if (!file) continue;
try {
- if (existsSync(file) && readFileSync(file, 'utf8').includes('data-i18n')) paths.push(p.path);
+ if (readFileSync(file, 'utf8').includes('data-i18n')) paths.push(p.path);
} catch {
- // unreadable — treat as not localized
+ // unreadable - treat as not localized
}
}
return JSON.stringify({ generated: true, count: paths.length, paths: paths.sort() }, null, '\t') + '\n';
diff --git a/tests/i18n-localized-pages.test.js b/tests/i18n-localized-pages.test.js
new file mode 100644
index 000000000..0fa89fad8
--- /dev/null
+++ b/tests/i18n-localized-pages.test.js
@@ -0,0 +1,69 @@
+/**
+ * hreflang coverage, unit tests.
+ *
+ * public/locales/localized-pages.json drives the <xhtml:link hreflang> alternates
+ * the dynamic sitemap emits, and it is derived by resolving each registered page
+ * path to the HTML file that serves it and checking for a data-i18n annotation.
+ * The resolution is the fragile half: a page whose file is not found is treated
+ * as "not localized", so a fully translated page quietly tells search engines it
+ * has no alternates. These pin every clean-URL shape the server actually serves.
+ */
+
+import { describe, expect, it } from 'vitest';
+
+import { localizedPageFile } from '../scripts/build-page-index.mjs';
+
+const at = (...present) => {
+ const set = new Set(present.map((p) => `/repo/${p}`));
+ return (file) => set.has(file);
+};
+
+describe('localizedPageFile', () => {
+ it('resolves the common case, pages/<slug>.html', () => {
+ expect(localizedPageFile('/what-is', at('pages/what-is.html'), '/repo')).toBe(
+ '/repo/pages/what-is.html',
+ );
+ });
+
+ it('maps / to the home page', () => {
+ expect(localizedPageFile('/', at('pages/home.html'), '/repo')).toBe('/repo/pages/home.html');
+ });
+
+ it('resolves a nested index under pages/ (/openai)', () => {
+ expect(localizedPageFile('/openai', at('pages/openai/index.html'), '/repo')).toBe(
+ '/repo/pages/openai/index.html',
+ );
+ });
+
+ it('resolves a page served straight out of public/ (/viewer)', () => {
+ expect(localizedPageFile('/viewer', at('public/viewer.html'), '/repo')).toBe(
+ '/repo/public/viewer.html',
+ );
+ });
+
+ it('resolves a nested index under public/ (/cookbook)', () => {
+ expect(localizedPageFile('/cookbook', at('public/cookbook/index.html'), '/repo')).toBe(
+ '/repo/public/cookbook/index.html',
+ );
+ });
+
+ it('prefers pages/ over public/ when both exist', () => {
+ expect(
+ localizedPageFile('/create', at('pages/create.html', 'public/create.html'), '/repo'),
+ ).toBe('/repo/pages/create.html');
+ });
+
+ it('tolerates surrounding slashes', () => {
+ expect(localizedPageFile('/features/ar/', at('pages/features/ar.html'), '/repo')).toBe(
+ '/repo/pages/features/ar.html',
+ );
+ });
+
+ it('returns null for an external link, so it never lands in the alternates list', () => {
+ expect(localizedPageFile('https://example.com/x', () => true, '/repo')).toBeNull();
+ });
+
+ it('returns null for a path with no file behind it (a dynamic route)', () => {
+ expect(localizedPageFile('/agent/123', at(), '/repo')).toBeNull();
+ });
+});