diff --git a/services/site/src/component/header.tsx b/services/site/src/component/header.tsx index b76e1d41cf2..7a8dfda511b 100644 --- a/services/site/src/component/header.tsx +++ b/services/site/src/component/header.tsx @@ -155,13 +155,13 @@ export function Header(props: { zen?: boolean; go?: boolean; hideGetStarted?: bo {i18n.t("nav.data")}
  • - {i18n.t("nav.zen")} + {i18n.t("nav.zen")}
  • - {i18n.t("nav.go")} + {i18n.t("nav.go")}
  • - {i18n.t("nav.enterprise")} + {i18n.t("nav.enterprise")}
  • @@ -256,16 +256,16 @@ export function Header(props: { zen?: boolean; go?: boolean; hideGetStarted?: bo
  • - {i18n.t("nav.zen")} + {i18n.t("nav.zen")}
  • - {i18n.t("nav.go")} + {i18n.t("nav.go")}
  • - {i18n.t("nav.enterprise")} + {i18n.t("nav.enterprise")}
  • diff --git a/services/site/src/component/site/arcade/chrome.tsx b/services/site/src/component/site/arcade/chrome.tsx index 42d8a5e1ba1..b790c3bb922 100644 --- a/services/site/src/component/site/arcade/chrome.tsx +++ b/services/site/src/component/site/arcade/chrome.tsx @@ -49,7 +49,7 @@ export { arcadeMenu } export function ArcadeChrome(props: { settingsRows?: () => JSX.Element }) { const i18n = useI18n() const language = useLanguage() - const links = createMemo(() => siteLinks(i18n.t, language.route)) + const links = createMemo(() => siteLinks(i18n.t, language.route, language.consoleRoute)) useViewportCover() // The same items and order as the site's sidebar (site.tsx) with the current settings. const nav = createMemo(() => { diff --git a/services/site/src/component/site/byos-options.tsx b/services/site/src/component/site/byos-options.tsx index 42c73e06153..40228136b8a 100644 --- a/services/site/src/component/site/byos-options.tsx +++ b/services/site/src/component/site/byos-options.tsx @@ -1,6 +1,7 @@ import "./byos-options.css" import { For, Show } from "solid-js" import { useI18n } from "~/context/i18n" +import { useLanguage } from "~/context/language" import { rich } from "~/i18n/rich" import { byos } from "~/lib/byos" import { byosOptions } from "~/lib/byos-options" @@ -24,11 +25,12 @@ const providers = marks.filter((provider) => !shown.has(provider.id)) /** Each option's lead, in place of the section's own (inside its lead paragraph). */ export function ByosOptionLeads() { + const language = useLanguage() const link = (text: string) => ( ({ text: phrase, href: byos.plansHref })), + byos.planLinks.map((phrase) => ({ text: phrase, href: language.consoleRoute(byos.plansHref) })), )} /> ) @@ -43,6 +45,7 @@ export function ByosOptionLeads() { export function ByosOptions() { const i18n = useI18n() + const language = useLanguage() const providersLink = docsUrl("/providers/") return (
    @@ -100,7 +103,7 @@ export function ByosOptions() { {(item) => (
  • - {item.name} + {item.name}
  • )} diff --git a/services/site/src/component/site/links.ts b/services/site/src/component/site/links.ts index bbc2d8bd949..4b5033ee566 100644 --- a/services/site/src/component/site/links.ts +++ b/services/site/src/component/site/links.ts @@ -4,7 +4,7 @@ import { docsUrl } from "~/lib/docs" import type { Translate } from "~/i18n" /** The sidebar and footer links, shared by the layout and the Markdown versions of the pages. */ -export function siteLinks(t: Translate, route: (path: string) => string) { +export function siteLinks(t: Translate, route: (path: string) => string, consoleHref = route) { return { // Every item the primary nav can show, in the default order (settings.ts navDefaults says which // show by default). Design mode reorders, hides and renames them (settings navConfig); the links @@ -22,14 +22,26 @@ export function siteLinks(t: Translate, route: (path: string) => string) { { id: "console", label: t("site.nav.console"), - href: "/console", + href: consoleHref("/console"), demo: route("/console-demo"), arrow: true, company: true, }, - { id: "models", label: t("site.nav.models"), href: "/console/models", arrow: true, company: true }, - { id: "subscriptions", label: t("site.nav.subscriptions"), href: "/console/go", arrow: true, company: true }, - { id: "enterprise", label: t("nav.enterprise"), href: "/console/enterprise", arrow: true, company: true }, + { id: "models", label: t("site.nav.models"), href: consoleHref("/console/models"), arrow: true, company: true }, + { + id: "subscriptions", + label: t("site.nav.subscriptions"), + href: consoleHref("/console/go"), + arrow: true, + company: true, + }, + { + id: "enterprise", + label: t("nav.enterprise"), + href: consoleHref("/console/enterprise"), + arrow: true, + company: true, + }, { id: "changelog", label: t("footer.changelog"), href: route("/changelog") }, // Also the GitHub mark in the top-right corner (site.tsx). { id: "github", label: t("nav.github"), href: config.github.repoUrl, external: true, arrow: true }, @@ -86,10 +98,10 @@ export function siteLinks(t: Translate, route: (path: string) => string) { { title: "Anomaly", links: [ - { label: t("site.nav.console"), href: "/console" }, - { label: "OpenCode Models", href: "/console/models" }, - { label: t("site.nav.subscriptions"), href: "/console/go" }, - { label: t("nav.enterprise"), href: "/console/enterprise" }, + { label: t("site.nav.console"), href: consoleHref("/console") }, + { label: "OpenCode Models", href: consoleHref("/console/models") }, + { label: t("site.nav.subscriptions"), href: consoleHref("/console/go") }, + { label: t("nav.enterprise"), href: consoleHref("/console/enterprise") }, { label: t("legal.privacy"), href: route("/legal/privacy-policy") }, { label: t("legal.terms"), href: route("/legal/terms-of-service") }, ], diff --git a/services/site/src/component/site/search-index.ts b/services/site/src/component/site/search-index.ts index 6fe0fe33684..11d9c994c51 100644 --- a/services/site/src/component/site/search-index.ts +++ b/services/site/src/component/site/search-index.ts @@ -5,7 +5,7 @@ import { localize } from "~/i18n/content" import { extensionsSource } from "~/i18n/content/areas/extensions" import { productDetailsSource } from "~/i18n/content/areas/product-details" import { productsSource } from "~/i18n/content/areas/products" -import type { Locale } from "~/lib/language" +import { consoleRoute, type Locale } from "~/lib/language" import { brandContent, brandMarkdown } from "~/lib/brand-content" import { brandAssets } from "~/lib/media" import type { ChangelogRelease } from "~/lib/changelog" @@ -60,7 +60,7 @@ export function buildSearchIndex( locale: Locale, dev: boolean, ): SearchItem[] { - const home = homeContent(t, route) + const home = homeContent(t, route, (path) => consoleRoute(locale, path)) const download = localize(locale, "download", downloadContent(t, route)) const press = localize(locale, "press", pressContent(t, route)) const brand = localize(locale, "brand", brandContent(t)) @@ -132,9 +132,17 @@ export function buildSearchIndex( }), ) const external: SearchItem[] = [ - { title: t("site.nav.console"), href: "/console", keywords: "models subscriptions zen go" }, - { title: t("site.nav.subscriptions"), href: "/console/go", keywords: "go go plus plans pricing subscribe" }, - { title: t("nav.enterprise"), href: "/console/enterprise", keywords: "sales business teams" }, + { title: t("site.nav.console"), href: consoleRoute(locale, "/console"), keywords: "models subscriptions zen go" }, + { + title: t("site.nav.subscriptions"), + href: consoleRoute(locale, "/console/go"), + keywords: "go go plus plans pricing subscribe", + }, + { + title: t("nav.enterprise"), + href: consoleRoute(locale, "/console/enterprise"), + keywords: "sales business teams", + }, { title: "GitHub", href: config.github.repoUrl, keywords: "source repo code" }, ].map((page) => ({ id: `page:${page.href}`, group: "Pages", context: page.href, ...page })) @@ -311,7 +319,7 @@ export function buildSearchIndex( /** The brand page as Markdown, as its "Copy rules for your agent" button copies it. */ export function brandRules(t: Translate, route: (path: string) => string) { - return markdownDocument("/brand", brandMarkdown, { t, route }) + return markdownDocument("/brand", brandMarkdown, { t, route, consoleRoute: route }) } /** Changelog entries and their versions, from the same JSON the changelog serves. */ diff --git a/services/site/src/component/site/site.tsx b/services/site/src/component/site/site.tsx index 59fc651c609..0f6b27989e5 100644 --- a/services/site/src/component/site/site.tsx +++ b/services/site/src/component/site/site.tsx @@ -395,7 +395,7 @@ export function Site(props: { } // Follows the locale, so a client-side language switch relabels the nav and footer. - const links = createMemo(() => siteLinks(i18n.t, language.route)) + const links = createMemo(() => siteLinks(i18n.t, language.route, language.consoleRoute)) // Every known item renders, in the saved list's order (Design mode shows the hidden ones, dimmed); // the shown ones are numbered and take the number keys. The items stay the same objects while the // list changes, so a reorder moves them in place. diff --git a/services/site/src/component/site/use-markdown.ts b/services/site/src/component/site/use-markdown.ts index 3be93bacf44..c74d9725452 100644 --- a/services/site/src/component/site/use-markdown.ts +++ b/services/site/src/component/site/use-markdown.ts @@ -54,6 +54,7 @@ function useMarkdownContext(data: MarkdownData) { return (): MarkdownContext => ({ t: i18n.t, route: language.route, + consoleRoute: language.consoleRoute, changelog: data.changelog?.(), releases: data.releases?.(), }) diff --git a/services/site/src/context/language.tsx b/services/site/src/context/language.tsx index 14b297d95db..77b67634897 100644 --- a/services/site/src/context/language.tsx +++ b/services/site/src/context/language.tsx @@ -15,6 +15,7 @@ import { localized, pageLocale, parseLocale, + consoleRoute as localeConsoleRoute, route as localeRoute, tag as localeTag, } from "~/lib/language" @@ -81,6 +82,9 @@ export const { use: useLanguage, provider: LanguageProvider } = createSimpleCont route(pathname: string) { return localeRoute(current(), pathname) }, + consoleRoute(pathname: string) { + return localeConsoleRoute(current(), pathname) + }, setLocale(next: Locale) { setCurrent(next) if (typeof document !== "object") return diff --git a/services/site/src/lib/get-started.ts b/services/site/src/lib/get-started.ts index a33c1e3f6ac..4ec85d2afc2 100644 --- a/services/site/src/lib/get-started.ts +++ b/services/site/src/lib/get-started.ts @@ -17,13 +17,13 @@ import { docsUrl } from "~/lib/docs" /** The free models the site names (models.dev's opencode provider has the full, live list). */ export const freeModels = ["Big Pickle", "DeepSeek V4.1 Flash Free"] -export function getStarted(route: (path: string) => string) { +export function getStarted(route: (path: string) => string, consoleHref = route) { const links = { download: route("/product"), // The docs' list of the free models (its pricing table above mixes in the paid ones). free: route(docsUrl("/console/models/#free-models")), subs: route(docsUrl("/providers/")), - go: "/console/go", + go: consoleHref("/console/go"), } return { title: "Get started", @@ -40,8 +40,8 @@ export function getStarted(route: (path: string) => string) { freeModels, subscriptions: byos.yours.items, plans: [ - { name: "OpenCode Go", amount: "$10", href: "/console/go#console-go-plan-go" }, - { name: "OpenCode Go Plus", amount: "$40", href: "/console/go#console-go-plan-go-plus" }, + { name: "OpenCode Go", amount: "$10", href: consoleHref("/console/go#console-go-plan-go") }, + { name: "OpenCode Go Plus", amount: "$40", href: consoleHref("/console/go#console-go-plan-go-plus") }, ], steps: [ { title: "Download", line: "Desktop, terminal or mobile." }, diff --git a/services/site/src/lib/home-content.ts b/services/site/src/lib/home-content.ts index 029549d91e6..bc35a28ec05 100644 --- a/services/site/src/lib/home-content.ts +++ b/services/site/src/lib/home-content.ts @@ -31,7 +31,7 @@ export function linkPhrases(text: string, links: readonly { text: string; href: * The home page copy, shared by the page and its Markdown version so the two never drift. * `route` localizes a site path. */ -export function homeContent(t: Translate, route: (path: string) => string) { +export function homeContent(t: Translate, route: (path: string) => string, consoleHref = route) { const docs = (path: string) => `https://opencode.ai${docsUrl(path)}` return { title: t("home.title"), @@ -163,10 +163,10 @@ export function homeContent(t: Translate, route: (path: string) => string) { title: t("site.nav.console"), headline: t("home.console.headline"), body: t("home.console.body"), - cta: { text: t("home.console.cta"), href: "/console" }, + cta: { text: t("home.console.cta"), href: consoleHref("/console") }, // The slim option: one line that names the Console, and a second action. slimHeadline: t("home.console.slimHeadline"), - sales: { text: t("home.console.sales"), href: "/console/enterprise" }, + sales: { text: t("home.console.sales"), href: consoleHref("/console/enterprise") }, }, } } diff --git a/services/site/src/lib/home-markdown.ts b/services/site/src/lib/home-markdown.ts index 2c541769d9d..13dfdcb9f25 100644 --- a/services/site/src/lib/home-markdown.ts +++ b/services/site/src/lib/home-markdown.ts @@ -9,9 +9,9 @@ import { productActionMarkdown } from "~/lib/product-markdown" /** The home page as Markdown, for `/index.md` and the in-page Markdown view. */ export function homeMarkdown(context: MarkdownContext) { - const content = homeContent(context.t, context.route) - const links = siteLinks(context.t, context.route) - const start = getStarted(context.route) + const content = homeContent(context.t, context.route, context.consoleRoute) + const links = siteLinks(context.t, context.route, context.consoleRoute) + const start = getStarted(context.route, context.consoleRoute) return blocks( `# ${content.hero.title}`, @@ -35,7 +35,7 @@ export function homeMarkdown(context: MarkdownContext) { `${byos.headline} ${richToMarkdown( linkPhrases( byos.line, - byos.planLinks.map((text) => ({ text, href: byos.plansHref })), + byos.planLinks.map((text) => ({ text, href: context.consoleRoute(byos.plansHref) })), ), )}`, `## ${content.tools.title}`, diff --git a/services/site/src/lib/language.ts b/services/site/src/lib/language.ts index 71deda05ce6..e29b0dfd67b 100644 --- a/services/site/src/lib/language.ts +++ b/services/site/src/lib/language.ts @@ -135,6 +135,35 @@ export function label(locale: Locale) { return LABEL[locale] } +// The Console serves its marketing pages at //console/... and keeps the guides and app +// pages (workspace, login, ...) at /console/...; consoleRoute leaves those alone too. +const consoleMarketing = [ + "/console", + "/console/models", + "/console/go", + "/console/enterprise", + "/console/teams", + "/console/support", + "/console/integrations", +] + +/** True for one of the Console's marketing pages, and only that page: its guides stay English. */ +function consoleMarketingPath(pathname: string) { + const path = pathname.split(/[?#]/, 1)[0]?.replace(/\/$/, "") || "/" + return consoleMarketing.includes(path) +} + +/** + * A link to a Console marketing page in the page's language. The Console serves its marketing pages + * at //console/... and keeps its guides and app pages (workspace, login, ...) at /console/...; + * this app's own route() leaves /console unprefixed (localized() excludes it). + */ +export function consoleRoute(locale: Locale, pathname: string) { + const next = strip(pathname) + if (locale === "en" || !consoleMarketingPath(next)) return next + return `/${locale}${next}` +} + export function english(locale: Locale) { return ENGLISH[locale] } diff --git a/services/site/src/lib/legacy.ts b/services/site/src/lib/legacy.ts index 5465a457e5b..cd51adfd387 100644 --- a/services/site/src/lib/legacy.ts +++ b/services/site/src/lib/legacy.ts @@ -1,4 +1,4 @@ -import type { Locale } from "~/lib/language" +import { consoleRoute, type Locale } from "~/lib/language" import { desktopAssets, updateApi } from "~/lib/download" // LEGACY REDIRECTS, every one to be removed later. Old URLs that outside links, bookmarks, scripts @@ -32,7 +32,7 @@ export function legacyRedirect(request: Legacy): Response | undefined { // links (`/go` about 75k requests a day, `/zen` 46k). Exact paths only: /zen/v1/* and /zen/go/v1/* // are the inference API, which a prefix match here would break. const moved = (request.locale ? localizedMoves : moves).get(request.path.replace(/(.)\/$/, "$1")) - if (moved && read) return redirect(301, `${moved}${request.search}`) + if (moved && read) return redirect(301, `${request.locale ? consoleRoute(request.locale, moved) : moved}${request.search}`) // The legacy dashboard and its sign-in, now the Console. The V1 CLI's "create a key at /auth" and // V1's usage-limit link /workspace//go (about 50k requests a day). @@ -83,7 +83,8 @@ const moves = new Map([ ["/enterprise", "/console/enterprise"], ]) -// The old site rendered these three pages in every language; their localized URLs follow them. +// The old site rendered these three pages in every language; their localized URLs follow them, and a +// non-English URL keeps its language in the Console page it redirects to. const localizedMoves = new Map([ ["/go", "/console/go"], ["/zen", "/console/models"], diff --git a/services/site/src/lib/llms.ts b/services/site/src/lib/llms.ts index 62dfb21633d..a6738244d83 100644 --- a/services/site/src/lib/llms.ts +++ b/services/site/src/lib/llms.ts @@ -11,7 +11,7 @@ import { markdownContext, pageMarkdown } from "~/lib/page-markdown" /** The llms.txt index (https://llmstxt.org): what OpenCode is and the Markdown version of every page. */ export async function llmsText(locale: Locale) { const context = await markdownContext(locale) - const content = homeContent(context.t, context.route) + const content = homeContent(context.t, context.route, context.consoleRoute) const page = (path: string) => `- ${link(pageMarkdown[path].title, context.route(markdownPath(path)))}: ${pageMarkdown[path].description}` const docs = (title: string, path: string, description: string) => `- ${link(title, docsUrl(path))}: ${description}` diff --git a/services/site/src/lib/markdown.ts b/services/site/src/lib/markdown.ts index e5454f8b70c..9ba4679b5a6 100644 --- a/services/site/src/lib/markdown.ts +++ b/services/site/src/lib/markdown.ts @@ -11,6 +11,7 @@ export type RichText = Inline[] export type MarkdownContext = { t: Translate route: (path: string) => string + consoleRoute: (path: string) => string changelog?: ChangelogView /** The releases as they come from GitHub, for pages that read them directly (the press kit). */ releases?: ChangelogRelease[] diff --git a/services/site/src/lib/page-markdown.ts b/services/site/src/lib/page-markdown.ts index 2ae27553181..890f0390b68 100644 --- a/services/site/src/lib/page-markdown.ts +++ b/services/site/src/lib/page-markdown.ts @@ -6,7 +6,7 @@ import { changelogEntryPageMarkdown, changelogMarkdown } from "~/lib/changelog-m import { areaKeys, changelogEntryView, changelogView, type ChangelogView } from "~/lib/changelog-notes" import { fontMarkdown } from "~/lib/font-content" import { homeMarkdown } from "~/lib/home-markdown" -import { route, type Locale } from "~/lib/language" +import { consoleRoute, route, type Locale } from "~/lib/language" import { legalMarkdown } from "~/lib/legal" import { legalHubMarkdown } from "~/lib/legal-documents" import { privacyPolicy } from "~/lib/legal/privacy-policy" @@ -136,6 +136,7 @@ export async function markdownContext( return { t: translator(locale), route: (path) => route(locale, path), + consoleRoute: (path) => consoleRoute(locale, path), changelog: page?.changelog?.(releases, query), releases: page?.releases ? releases : undefined, } diff --git a/services/site/src/lib/sitemap.ts b/services/site/src/lib/sitemap.ts index 1fb85f710c1..230abac3806 100644 --- a/services/site/src/lib/sitemap.ts +++ b/services/site/src/lib/sitemap.ts @@ -13,7 +13,9 @@ export const sitemapFiles = [ "/sitemap-pages.xml", // this app's pages, built below "/docs/sitemap.xml", // the V2 docs (src/docs) "/data/sitemap.xml", // the Data pages, from the stats app - "/console/sitemap.xml", // the Console pages, from the Console app + "/console/sitemap.xml", // the Console pages, from the Console app, in English + // The same pages from the Console app in the site's other languages. + ...LOCALES.filter((locale) => locale !== "en").map((locale) => `/${locale}/console/sitemap.xml`), ] /** The sitemaps as a sitemaps.org `sitemapindex`. */ diff --git a/services/site/src/routes/index.tsx b/services/site/src/routes/index.tsx index 29e1c901b73..b07827937fc 100644 --- a/services/site/src/routes/index.tsx +++ b/services/site/src/routes/index.tsx @@ -96,7 +96,7 @@ export default function Home() { siteSettings.consoleLayout === "block" && siteSettings.consoleSection !== "off" ? "panel" : siteSettings.consoleSection - const content = createMemo(() => homeContent(i18n.t, language.route)) + const content = createMemo(() => homeContent(i18n.t, language.route, language.consoleRoute)) // Its own meta description (140–155 characters). Until a locale translates it, the locale keeps // the tagline and hero subtitle it already has in its language. const description = () => @@ -956,7 +956,9 @@ function stripTags(html: string) { function GetStarted() { const i18n = useI18n() const language = useLanguage() - const content = createMemo(() => localize(language.locale(), "getStarted", getStarted(language.route))) + const content = createMemo(() => + localize(language.locale(), "getStarted", getStarted(language.route, language.consoleRoute)), + ) // On a phone or tablet, Download is that device's app; on a computer, the desktop build. const platform = useDevicePlatform() const downloadSlug = () => (isMobile(platform()) ? "mobile" : "desktop") @@ -1189,7 +1191,7 @@ function BringYourOwnSubs() { const [tab, setTab] = createSignal<"yours" | "ours">("yours") const yours = () => const providers = () => - const goHref = () => subs().plansHref + const goHref = () => language.consoleRoute(subs().plansHref) const select = (next: "yours" | "ours", focus?: boolean) => { setTab(next) if (focus) document.getElementById(`byos-tab-${next}`)?.focus() diff --git a/services/site/test/console-links.test.ts b/services/site/test/console-links.test.ts new file mode 100644 index 00000000000..3091511f22e --- /dev/null +++ b/services/site/test/console-links.test.ts @@ -0,0 +1,82 @@ +import { describe, expect, test } from "bun:test" +import { siteLinks } from "~/component/site/links" +import { translator } from "~/i18n" +import { getStarted } from "~/lib/get-started" +import { homeContent } from "~/lib/home-content" +import { consoleRoute, localized, route } from "~/lib/language" + +const t = translator("en") +const de = (path: string) => consoleRoute("de", path) + +describe("consoleRoute", () => { + test("prefixes the Console's marketing pages for non-English pages", () => { + for (const path of [ + "/console", + "/console/models", + "/console/go", + "/console/enterprise", + "/console/teams", + "/console/support", + "/console/integrations", + ]) + expect(consoleRoute("de", path)).toBe(`/de${path}`) + expect(consoleRoute("ru", "/console/go#console-go-plan-go")).toBe("/ru/console/go#console-go-plan-go") + expect(consoleRoute("de", "/de/console/models/")).toBe("/de/console/models/") + expect(consoleRoute("de", "/console/models?sort=price")).toBe("/de/console/models?sort=price") + }) + + test("leaves English and the Console's app pages alone", () => { + expect(consoleRoute("en", "/console/go")).toBe("/console/go") + for (const path of [ + "/console/workspace", + "/console/login", + "/console/funnel/v1.js", + "/console/sitemap.xml", + "/auth", + ]) + expect(consoleRoute("de", path)).toBe(path) + }) + + test("matches marketing pages exactly, not their subpaths", () => { + expect(consoleRoute("de", "/console/models/compare")).toBe("/console/models/compare") + expect(consoleRoute("de", "/console/integrations/slack")).toBe("/console/integrations/slack") + }) + + test("keeps the middleware redirect for prefixed Console URLs", () => { + // localized() excludes /console, so /de/console 301s to /console until the Console serves it. + expect(localized("/console")).toBe(false) + expect(localized("/console/go")).toBe(false) + expect(route("de", "/de/console")).toBe("/console") + }) +}) + +describe("localized Console links", () => { + test("the sidebar and footer use the page's language for Console marketing pages", () => { + const links = siteLinks(t, (path) => route("de", path), de) + const nav = Object.fromEntries(links.nav.map((item) => [item.id, item.href])) + expect(nav.console).toBe("/de/console") + expect(nav.models).toBe("/de/console/models") + expect(nav.subscriptions).toBe("/de/console/go") + expect(nav.enterprise).toBe("/de/console/enterprise") + expect(nav.docs).toBe("/docs") + const anomaly = links.columns.find((column) => column.title === "Anomaly") + expect(anomaly?.links.filter((item) => item.href.startsWith("/de/console")).map((item) => item.href)).toEqual([ + "/de/console", + "/de/console/models", + "/de/console/go", + "/de/console/enterprise", + ]) + }) + + test("the home Console and Get started CTAs follow the page's language", () => { + const content = homeContent(t, (path) => route("de", path), de) + expect(content.console.cta.href).toBe("/de/console") + expect(content.console.sales.href).toBe("/de/console/enterprise") + const start = getStarted((path) => route("de", path), de) + expect(start.links.go).toBe("/de/console/go") + expect(start.plans.map((plan) => plan.href)).toEqual([ + "/de/console/go#console-go-plan-go", + "/de/console/go#console-go-plan-go-plus", + ]) + }) +}) diff --git a/services/site/test/legacy.test.ts b/services/site/test/legacy.test.ts index 6a48905ea0c..8af1faa4297 100644 --- a/services/site/test/legacy.test.ts +++ b/services/site/test/legacy.test.ts @@ -40,8 +40,13 @@ describe("legacy redirects", () => { expect(get("/go", { method: "POST" })).toBeUndefined() }) - test("localized go, zen and enterprise follow to the Console; other localized moves don't", () => { - expect(get("/enterprise", { locale: "de" })?.headers.get("Location")).toBe("/console/enterprise") + test("localized go, zen and enterprise follow to the Console in their language; other localized moves don't", () => { + expect(get("/go", { locale: "de" })?.headers.get("Location")).toBe("/de/console/go") + expect(get("/zen", { locale: "de" })?.headers.get("Location")).toBe("/de/console/models") + expect(get("/zen", { locale: "de", search: "?ref=app" })?.headers.get("Location")).toBe( + "/de/console/models?ref=app", + ) + expect(get("/enterprise", { locale: "de" })?.headers.get("Location")).toBe("/de/console/enterprise") expect(get("/pricing", { locale: "de" })).toBeUndefined() }) diff --git a/services/site/test/sitemap.test.ts b/services/site/test/sitemap.test.ts index a1dccabcf11..7b92dd6df9e 100644 --- a/services/site/test/sitemap.test.ts +++ b/services/site/test/sitemap.test.ts @@ -53,6 +53,10 @@ describe("sitemap", () => { expect(files).toEqual(sitemapFiles.map((file) => `${config.baseUrl}${file}`)) expect(files).toContain(`${config.baseUrl}/sitemap-pages.xml`) expect(files).toContain(`${config.baseUrl}/docs/sitemap.xml`) + expect(files).toContain(`${config.baseUrl}/console/sitemap.xml`) + for (const locale of LOCALES.filter((locale) => locale !== "en")) + expect(files).toContain(`${config.baseUrl}/${locale}/console/sitemap.xml`) + expect(files).not.toContain(`${config.baseUrl}/en/console/sitemap.xml`) expect(files.some((file) => file === `${config.baseUrl}/sitemap.xml`)).toBe(false) })