SEO: multilingual homepage (homeSlug per locale in path/sitemap), Article + llms.txt generators, siteDescription fallback, composeTitle dedup

This commit is contained in:
2026-09-15 15:31:08 +02:00
parent 87d575f335
commit 33ae035adc
25 changed files with 398 additions and 61 deletions
+9 -2
View File
@@ -35,7 +35,7 @@ type BuildMetadataArgs = {
baseUrl?: string
config: I18nConfig
/** Home slug that collapses to the locale root. Defaults to 'home'. */
homeSlug?: string | Record<string, string>
homeSlug?: Record<string, string> | string
/** Resolved OG image URL (page image or site defaultShareImage). */
imageUrl?: null | string
/** Current locale being rendered. */
@@ -67,6 +67,12 @@ type BuildMetadataArgs = {
query?: string
/** Separator between page title and site name. Defaults to ' | '. */
separator?: string
/**
* Global fallback description (from SiteSettings.siteDescription). Used when a
* page has no meta.description — better than emitting no description at all
* (Google would then scrape random on-page text for the snippet).
*/
siteDescription?: null | string
/** Site name for title composition and OG. */
siteName?: null | string
/** slug per locale for this document — drives canonical + hreflang. */
@@ -94,6 +100,7 @@ export function buildMetadata({
prefix,
query,
separator,
siteDescription,
siteName,
slugs,
}: BuildMetadataArgs): PageMetadata {
@@ -105,7 +112,7 @@ export function buildMetadata({
const resolvedPageTitle = meta?.title?.trim() || pageTitle?.trim() || undefined
const title =
override || composeTitle({ order, pageTitle: resolvedPageTitle, separator, siteName })
const description = meta?.description?.trim() || undefined
const description = meta?.description?.trim() || siteDescription?.trim() || undefined
const origin = baseUrl?.replace(/\/$/, '') ?? ''
const suffix = query ?? ''