diff options
| author | Adam <[email protected]> | 2026-02-06 11:30:40 -0600 |
|---|---|---|
| committer | GitHub <[email protected]> | 2026-02-06 11:30:40 -0600 |
| commit | 24cd84cda5522e4607e8e3fb3626f289d7e348f4 (patch) | |
| tree | 81dec57e565c24255e5e6ad2dfac58ea0e770018 /packages/console/app/script | |
| parent | 8069197329d2d1b958d8e7f63daaf9662a97027d (diff) | |
| download | opencode-24cd84cda5522e4607e8e3fb3626f289d7e348f4.tar.gz opencode-24cd84cda5522e4607e8e3fb3626f289d7e348f4.zip | |
feat(www): locale specific urls (#12508)
Diffstat (limited to 'packages/console/app/script')
| -rwxr-xr-x | packages/console/app/script/generate-sitemap.ts | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/packages/console/app/script/generate-sitemap.ts b/packages/console/app/script/generate-sitemap.ts index 6cbffcb85..bdce205b9 100755 --- a/packages/console/app/script/generate-sitemap.ts +++ b/packages/console/app/script/generate-sitemap.ts @@ -3,6 +3,7 @@ import { readdir, writeFile } from "fs/promises" import { join, dirname } from "path" import { fileURLToPath } from "url" import { config } from "../src/config.js" +import { LOCALES, route } from "../src/lib/language.js" const __dirname = dirname(fileURLToPath(import.meta.url)) const BASE_URL = config.baseUrl @@ -27,12 +28,14 @@ async function getMainRoutes(): Promise<SitemapEntry[]> { { path: "/zen", priority: 0.8, changefreq: "weekly" }, ] - for (const route of staticRoutes) { - routes.push({ - url: `${BASE_URL}${route.path}`, - priority: route.priority, - changefreq: route.changefreq, - }) + for (const item of staticRoutes) { + for (const locale of LOCALES) { + routes.push({ + url: `${BASE_URL}${route(locale, item.path)}`, + priority: item.priority, + changefreq: item.changefreq, + }) + } } return routes @@ -50,11 +53,13 @@ async function getDocsRoutes(): Promise<SitemapEntry[]> { const slug = file.replace(".mdx", "") const path = slug === "index" ? "/docs/" : `/docs/${slug}` - routes.push({ - url: `${BASE_URL}${path}`, - priority: slug === "index" ? 0.9 : 0.7, - changefreq: "weekly", - }) + for (const locale of LOCALES) { + routes.push({ + url: `${BASE_URL}${route(locale, path)}`, + priority: slug === "index" ? 0.9 : 0.7, + changefreq: "weekly", + }) + } } } catch (error) { console.error("Error reading docs directory:", error) |
