fix(cms): resolve internal CTA links per locale via a page selector (MITHOME-123)

The home hero CTA stored a free-text href "/kapcsolat" that predated the
locale-prefixed routing (MITHOME-114), so the main call-to-action led to
a 404. Internal targets were typed by hand and could never follow the
locale or its translated slug.

CTA links now choose between an internal page (home/about/services/
contact/privacy/terms) and an external URL. Page links are resolved per
request with localePath(), giving /hu/kapcsolat and /en/contact; external
links (webmail) keep their localized href. A Payload migration converts
existing internal paths to page links on the published global and every
draft/version, idempotently and independent of the locale migration's
order. The global-doc iteration shared with MITHOME-111 moved to
src/lib/migrate-global-docs.ts; the JSON seed emits the new shape too.

Verified on a copy of the staging DB: both migrations ran on startup,
/hu and /en CTAs point to their contact pages (200), webmail unchanged,
admin shows the selector, toggles the fields and blocks publishing a URL
link without a URL.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Do Siki
2026-09-29 01:26:42 +02:00
co-authored by Claude Opus 5.5
parent 38d34fab4c
commit e8ff7adeb5
12 changed files with 460 additions and 65 deletions
+7
View File
@@ -1,4 +1,5 @@
import * as migration_20260929_localize_globals from './20260929_localize_globals'
import * as migration_20260929_cta_page_links from './20260929_cta_page_links'
/**
* Payload migrations, in order. Passed to `mongooseAdapter({ prodMigrations })`
@@ -10,4 +11,10 @@ export const migrations = [
down: migration_20260929_localize_globals.down,
name: '20260929_localize_globals',
},
{
// MITHOME-123 — order-independent from the locale migration (handles both href shapes).
up: migration_20260929_cta_page_links.up,
down: migration_20260929_cta_page_links.down,
name: '20260929_cta_page_links',
},
]