src/lib/seo.ts is the single source for page alternates (self canonical
+ hreflang hu/en/x-default), sitemap entries (every page in both
languages, with alternates) and robots rules. Per the user's decisions
every page is announced in both languages regardless of the English
approval status, and staging is never indexed: robots.txt disallows
all, the sitemap is empty and every page carries a noindex meta.
Home and catch-all page metadata now carry alternates and a locale-
correct og:url. Staging smoke SMOKE-09 checks hreflang, canonical,
noindex and robots.txt. Documented in architecture.md.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A compact "HU | EN" switcher next to the theme toggle (desktop) and the
menu button (mobile). Each link opens the current page in the other
language with its translated slug (/hu/szolgaltatasok <-> /en/services),
unknown pages fall back to the language's home. English is always
offered (user decision), even before a page's English is approved.
Links carry lang/hrefLang, the active one aria-current, and the group a
localized accessible name. No flags: a flag marks a country, not a
language. Unit and component tests plus staging smoke SMOKE-08.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sync localized legal pages, English translation status, non-destructive
AI draft import, validated English legal pages and the admin validation
prompt into content-management, and the approved-English-only gate into
public-site.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The SIGTERM/SIGINT handlers were re-registered on every module evaluation,
and a build worker receiving both signals logged again after logger.end(),
raising ERR_STREAM_WRITE_AFTER_END during `next build`. Guard with an own
flag (winston's readable-stream@3 Logger has no writableEnded) and register
the handlers once per process with process.once.
Closes MITHOME-126
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Found during the live check on a staging copy: the embedded browser
denied the async Clipboard API, so "copy prompt" failed silently. The
panel now falls back to a selection copy and finally leaves the prompt
selected with a Ctrl/Cmd+C hint; covered by component tests.
Payload only shows a generic "field is invalid" toast for the rejected
approval, so the legal pages' status field description now states the
two-model rule next to the field.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Validation of legal translations is a manual flow (user decision): copy
the prompt, run it in any vendor's model, paste the answer back. The
legal validation block now holds the prompt panel and a list of reviews
(model, date, verdict, pasted answer, notes) instead of a model list and
report link. Approval needs two distinct models whose latest complete
review does not reject; a newer review supersedes a model's rejection.
The locale path collector now looks through row/collapsible wrappers.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
buildLegalValidationPrompt() is the single review template: the criteria
(meaning, GDPR terminology, obligation strength, preserved markers,
clarity), a severity table output with a final verdict, and the
Hungarian/English text of every section paired by id, missing English
flagged as high severity. The legal page sidebar shows it through the
LegalValidationPrompt UI field (hu + en read from REST with draft=true
and no locale fallback) with copy and refresh buttons.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Legal pages get a sidebar "legal validation" record (validating models,
date, report reference). Their English translation status can only be
set to "approved" when at least two distinct models, the date and the
report are recorded; page globals are unaffected. The admin description
states that model review does not replace legal advice.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
src/content/translations/en.json is a reviewable hu -> en memory built
from the live staging content (179 texts). Tests guard every entry:
placeholders, HTML, legal markup and e-mail/URL literals must survive.
fillEnglishDraft() fills only empty English values whose Hungarian text
exactly matches a memory key (lists all-or-nothing) and moves the page
status none -> ai-draft; it never sets "approved" or overwrites English.
The 20260929_en_ai_draft migration applies it to every global and legal
page (published doc + latest version), reports untranslated texts, and
wraps legacy values first so it does not depend on migration order.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Every page global and legal page gets a shared "English translation
status" sidebar field (none / AI draft awaiting review / approved).
The content adapter reads through readGated(): an English page renders
English text only when its translation is approved, otherwise the
Hungarian text of the same page, while links keep resolving to /en/...
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Legal page title, last-updated text and section titles/contents become
localized; slug and section ids stay shared. A Payload migration wraps
existing values into { hu: value } on every legal page and its whole
version history, like the globals migration (MITHOME-111).
The migration helper now handles collections as well as globals
(rewriteDocs) and can scope version rewrites to the latest working copy,
which the upcoming English import needs. Migration tests share an
in-memory Mongo fake that honours query filters.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Legal pages localization, English translation status with a public
gate, a non-destructive AI-draft import from a hu->en translation
memory, and mandatory multi-model validation of legal translations
with a copyable validation prompt in the admin.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
General rule: links to another host open in a new tab with
rel="noopener noreferrer"; internal paths, mailto: and tel: stay in the
same tab. Behaviour was inconsistent before — the home Webmail button
opened in the same tab while the other webmail links did not, and the
CTA and header relied on a manual "external" switch.
src/lib/external-link.ts decides from the URL (externalLinkProps for
JSX, openExternalLinksInNewTab for CMS-provided HTML in About paragraphs,
legal pages and the GDPR label). All link sites use it; the manual
"external" CTA checkbox and NavigationItem flag are removed so the rule
cannot be bypassed. Rule documented in architecture.md and CLAUDE.md;
staging smoke SMOKE-07 checks every external homepage link.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sync the localized page globals and lossless locale migration
requirements into the content-management spec.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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>
Mark MITHOME-111 done. Document the mandatory pre-deploy mongodump and
the restore-based rollback for releases that carry Payload data
migrations, and record the live verification results in the OpenSpec
tasks (staging DB copy: hu/draft/version content unchanged, en falls
back, second run is a no-op).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Mark every translatable text/textarea field of the Home, About, Services,
Contact and Common globals as localized. Icons, row ids, the external
flag and the postal address stay shared; CTA hrefs are localized because
internal routes differ per locale. String lists (paragraphs, bullets,
features, spec items) are localized at array level so locales can have
different item counts; structured rows share order/icons and localize
only their inner text.
Existing data is not re-seeded (that would overwrite admin edits): a
Payload migration wraps legacy values into { hu: value } on the published
global and every draft/version record, idempotently, and runs on
production startup via prodMigrations. Paths are derived from the Global
configs themselves so the migration cannot drift from the schema.
OpenSpec change: openspec/changes/localize-globals-mithome-111
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The Content layer description across the AI-agent steering docs still
described the pre-migration JSON system as the live, current mechanism
— rule #1 in CLAUDE.md and the Content row in architecture.md
explicitly told future work (and future agent sessions) to edit
proto/src/content/pages/*.json directly, which the live site hasn't
read since MITHOME-91.
Rewrote, per the ticket's named targets:
- .agent/steering/architecture.md: system overview, the Content layer
table row, rule #1, and the Content Management code example now
describe Payload Globals/Collections + the payload-content.ts Local
API adapter, with /admin as the editing surface.
- CLAUDE.md: Stack line now names Payload CMS, rule #1 rewritten the
same way, and the project-structure tree gets the (frontend)/(payload)
route groups, globals/, collections/, and payload.config.ts that were
entirely missing from it.
Also fixed directly-adjacent staleness found while doing this pass —
same "how is content edited" documentation debt, just not literally
named in the ticket:
- .agent/AGENTS.md: same project-structure tree gap as CLAUDE.md.
- .agent/workflows/new-feature.md: step 3 told contributors to edit
the JSON file directly; now points at the Payload config + admin.
- .agent/workflows/review.md: the example "flag hardcoded text" review
comment suggested moving it into the JSON file.
- .agent/steering/development-rules.md: the TRADEOFF code example
literally used "JSON content management vs CMS" as a live open
decision — that decision is resolved, updated the example to match.
- README.md: the entire "Tartalomkezelés" section and a "CMS
Publikálás gomb" paragraph described the retired content-editor.js
workflow (git-push-based publish, JSON directory tour) as current;
also dropped a dead link to docs/felhasznaloi-utmutato.md, deleted
in MITHOME-93.
Doc-only change, no proto/ source touched — no gate to run beyond a
sanity re-read of each edited file.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
User request: the partner logos were laid out with flex-wrap, which
doesn't align items into clean rows/columns. Switched to CSS grid
(grid-cols-1 sm:grid-cols-2 md:grid-cols-3), so it never exceeds 3
columns regardless of viewport width or partner count.
w-fit + mx-auto (not inline-grid + mx-auto) so the grid centers
correctly even with fewer partners than 3 — auto margins don't center
inline-level boxes, but do for block-level ones sized to their content.
Verified live in the browser at 1200px width with 5 temporary test
partners (reusing an existing Media doc, deleted after): renders as a
3-then-2 grid, centered, no console errors.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Adds the two test categories the ticket asked for, replacing the old
content-JSON-schema-only testing story now that Payload is the real
source of truth:
1. src/payload-config.test.ts — fast, DB-free unit tests over the
Collection/Global config objects themselves. WHY not importing
payload.config.ts directly: it pulls in the real `payload` and
`@payloadcms/db-mongodb` packages as values (not just types), which
are ESM-only and Jest's default transformIgnorePatterns skips
node_modules entirely — confirmed by trying it
(`SyntaxError: Cannot use import statement outside a module` from
payload's own dist). Individual collection/global files only ever
`import type` from 'payload' (erased at compile time), so they're
safely importable in isolation. Two of the assertions are
deliberate regression guards for real bugs found earlier this
session (MITHOME-121): Media.access.read must stay public, and
Partners.logo must stay optional.
2. scripts/test-payload-local-api.ts (npm run test:payload) — exercises
every src/lib/payload-content.ts getter plus a full
create/findByID/delete cycle against a real, already-migrated
MongoDB. WHY a plain node script instead of a Jest integration
config: same ESM problem as above, and Payload's dependency graph
is too broad to safely add to transformIgnorePatterns — this
follows the same working `node --import tsx` pattern already used
by migrate-content-to-payload.ts. Not wired into
pre-deploy-tests.sh (needs a live, pre-migrated MongoDB, same
reasoning as the removed CMS integration tests); run manually or
before a release.
3. Fixed the pre-existing (Docker-stack-gated, so silently never
caught) staleness in integration.test.ts and e2e-docker.test.ts:
unprefixed routes (/rolunk) → locale-prefixed (/hu/rolunk), and
Mongo assertions against the old site_config/contact_submissions
collections → the real globals/legal-pages/partners/
contact-submissions collections Payload actually uses. Also fixed
an unrelated stale error-message assertion for spam detection that
never matched the route's real string.
Verified: full gate green (tsc, lint, 63 unit tests — 13 new — build),
and separately ran test:payload live against the dev MongoDB (8/8
passed, including the write/read/delete cycle actually hitting Mongo).
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
/api/contact used to write straight to a raw, Payload-external MongoDB
collection (contact_submissions, via proto/src/lib/mongodb.ts's
getCollection) — the client had no way to see incoming messages except
by reading the database directly. Rate limiting, length caps, email
validation, and spam-keyword filtering all stay on the route exactly
as before; only the persistence target changed.
New: src/collections/ContactSubmissions.ts (name, email, subject,
message, gdprConsent checkbox, status select defaulting to "new").
Deliberately no custom `access` block — Payload's default
(authenticated-only for every REST operation) is exactly right here:
the client reads submissions in the admin, nobody can read or write
them through the public REST API, and the route's own write uses the
Local API (payload.create), which runs with overrideAccess: true by
default and so isn't blocked by that same rule. No versions/drafts
(a submission is a fact, not editable content) and no field-level
length/format validation duplicated in the collection, matching the
ticket's explicit scope: those checks live on the route.
route.ts: replaced getCollection()/insertOne() with
getPayload({config}).create({ collection: 'contact-submissions', ... }).
Removed the now-unused getCollection() helper from lib/mongodb.ts
(checkMongoConnection/getDb stay, used by /api/health) and its test.
Test gotcha worth documenting: next/jest's SWC transform rewrites the
`@payload-config` tsconfig-path alias to a real relative specifier at
transform time, so `jest.mock('@payload-config', ...)` never actually
intercepts what route.ts requires — it silently falls through to the
real payload.config.ts (mongooseAdapter, live Mongo needed). Fixed by
mocking the resolved relative path instead
(`jest.mock('../../../payload.config', ...)`); documented inline in
route.unit.test.ts for whoever hits this next (MITHOME-96 will need
the same trick for other Payload-backed routes/collections).
Verified live end-to-end, not just the test suite: submitted the real
contact form on /hu/kapcsolat, got the success message, found the
submission in /admin/collections/contact-submissions with all fields
correct (including gdprConsent checked and status "Új"/New), then
deleted the test record. Zero console errors in a fresh tab. Gate:
tsc, lint, unit tests (50 passed — one fewer than before, the removed
getCollection test), production build all green.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
User request: there was no way to get from the Payload admin back to
the public website — confirmed live (read_page on the admin nav showed
only internal links: collections, globals, account, logout).
Added a "🌐 Honlap megnyitása" link next to the QuickSearch box
(src/components/admin/QuickSearch.tsx — same header slot, no new
admin.components entry or importmap regen needed since the export name
didn't change). Opens in a new tab, points at siteConfig.general.url
(NEXT_PUBLIC_SITE_URL), so it resolves to the correct site per
environment automatically — stage.mozdit.hu on staging, the production
domain once that's live.
Verified live in the browser: link renders next to the search box,
resolves to the expected URL (find() confirmed the href), zero new
console errors in a fresh tab. Gate: tsc, lint, unit tests (51 passed),
production build all green.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
User request: don't force a logo upload to save a Partner — allow
saving name+url first, logo later. Removed `required: true` from
Partners.ts logo field. The frontend (getPartners(), payload-content.ts)
already filters out logo-less partners before rendering, so this is
safe: a partner without a logo just doesn't show on the public site
yet, nothing breaks.
While verifying this live (create a partner without a logo, check the
public homepage doesn't break), found a real, previously-undetected
bug that predates this change: partner logos never actually loaded on
the public site at all. Payload's default collection read access is
"authenticated users only" (Boolean(user)), and Media.ts never
overrode it — so GET /api/media/file/<name> always 403'd for anyone
not logged into the admin. Next.js's image optimizer (/_next/image)
fetches that URL server-side without forwarding the browser's admin
session cookie, so it always got a 403 back, which it reports as "The
requested resource isn't a valid image" (400) — the <img> silently
rendered as a broken image icon on the homepage the whole time. Fixed
by adding `access: { read: () => true }` to Media.ts — write
operations (create/update/delete) stay admin-only via Payload's
default.
Verified live in the browser: created a Partner with only name+url via
the admin (saved successfully, no required-field error), confirmed it
correctly does NOT appear on the public homepage (no logo yet), then
deleted that test record. Separately, in a fresh unauthenticated tab,
confirmed the existing Partner's logo now actually renders on /hu
(previously a broken image icon) — curl-verified both
/api/media/file/<name> and /_next/image?url=... return 200 without any
auth. Zero console errors. Gate: tsc, lint, unit tests (51 passed),
production build all green.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>