Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions web/app/[locale]/(landing)/wall-of-love/page.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { useTranslations, useLocale } from "next-intl";
import { getTranslations } from "next-intl/server";
import { buildAlternates, openGraphDefaults, seoDescription, twitterSummary } from "@/i18n/seo";
import { buildAlternates, openGraphDefaults, twitterSummary } from "@/i18n/seo";
import { wallOfLoveSeoCopy } from "@/i18n/audited-seo";
import { SiteHeader } from "@/app/[locale]/components/site-header";
import {
testimonials,
Expand All @@ -13,8 +14,7 @@ export async function generateMetadata({ params }: { params: Promise<{ locale: s
const { locale } = await params;
const t = await getTranslations({ locale, namespace: "wallOfLove" });
const alternates = buildAlternates(locale, "/wall-of-love");
const title = t("metaTitle");
const description = seoDescription(locale, t("metaDescription"));
const { title, description } = wallOfLoveSeoCopy(locale, t);
return {
title,
description,
Expand Down
14 changes: 14 additions & 0 deletions web/i18n/audited-seo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,20 @@ export function assetsSeoCopy(
};
}

export function wallOfLoveSeoCopy(
locale: string,
t: SeoMessageLookup,
) {
const title = locale === "en" ? t("metaTitle") : `${t("title")} — cmux`;
const description =
locale === "en" ? t("metaDescription") : t("description");

return {
title: seoTitle(locale, title, { minLength: 0 }),
description: seoDescription(locale, description),
};
}

export function blogIndexSeoCopy(
locale: string,
t: SeoMessageLookup,
Expand Down
32 changes: 32 additions & 0 deletions web/tests/seo.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import {
landingPageSeoCopy,
ohMyPiSeoCopy,
pricingSeoCopy,
wallOfLoveSeoCopy,
} from "../i18n/audited-seo";
import { englishFallbackContentLocales } from "../i18n/locale-availability";
import { locales } from "../i18n/routing";
Expand Down Expand Up @@ -230,6 +231,37 @@ describe("SEO metadata helpers", () => {
}
});

test("builds Wall of Love metadata from authored copy in every locale", async () => {
const englishMessages = await messagesFor("en");

for (const locale of locales) {
const messages = await messagesFor(locale);
const copy = wallOfLoveSeoCopy(
locale,
messageLookup(messages.wallOfLove),
);
const expectedTitle =
locale === "en"
? englishMessages.wallOfLove.metaTitle
: messages.wallOfLove.title;
const expectedDescription =
locale === "en"
? englishMessages.wallOfLove.metaDescription
: messages.wallOfLove.description;

expect(copy.title).toContain(expectedTitle);
expect(copy.description).toStartWith(expectedDescription);
expect(searchSnippetLength(copy.title)).toBeLessThanOrEqual(60);
expect(searchSnippetLength(copy.description)).toBeLessThanOrEqual(160);

if (locale !== "en") {
expect(copy.description).not.toContain(
englishMessages.wallOfLove.metaDescription,
);
}
}
});

test("selects bounded, route-specific copy for the audited matrix", async () => {
for (const locale of locales) {
const messages = await messagesFor(locale);
Expand Down
Loading