SEO builder pure functions for all 6 Online Board route types, each returning SeoHeadProps with title, description, canonical, hreflang, OG, and Twitter card. Populated empty EN locale SEO keys with English translations matching the Russian pattern.
3.8 KiB
Phase 2F — SEO + JSON-LD for Online Board
Parent plan:
2026-04-14-phase-2-online-board-master.md(sub-plan 2F) Depends on: 2E (route pages), 1F-seo (SeoHead,buildHreflangSet,JsonLdRenderer), 1C (i18n)
Goal
Wire SEO metadata (title, description, canonical, hreflang, OG, Twitter Card) and JSON-LD structured data (Flight, ItemList) into all 6 Online Board route pages. SEO builders are pure functions; JSON-LD builders produce schema-dts typed objects.
Deliverables
src/features/online-board/seo.ts— 6 builder functions returningSeoHeadPropssrc/features/online-board/json-ld.ts— 2 JSON-LD builder functions- Updated route pages wiring
<SeoHead>and<JsonLdRenderer> - Populated EN locale SEO keys (RU already has values)
Tasks
T1 — Populate EN locale SEO keys
The EN locale file has empty SEO.BOARD keys. Add English translations matching the Russian pattern.
- File:
src/i18n/locales/en/common.json - Keys:
SEO.BOARD.MAIN,SEO.BOARD.FLIGHT-SEARCH,SEO.BOARD.DEPARTURE-SEARCH,SEO.BOARD.ARRIVAL-SEARCH,SEO.BOARD.ROUTE-SEARCH,SEO.BOARD.FLIGHT-DETAILS
T2 — TDD: SEO builder functions (seo.ts)
Write tests first in src/features/online-board/seo.test.ts, then implement in src/features/online-board/seo.ts.
Functions:
buildOnlineBoardStartSeo(locale, canonicalOrigin)— start page SEObuildFlightSearchSeo(params, locale, canonicalOrigin, cityNames?)— flight number searchbuildDepartureSearchSeo(params, locale, canonicalOrigin, cityNames?)— departure searchbuildArrivalSearchSeo(params, locale, canonicalOrigin, cityNames?)— arrival searchbuildRouteSearchSeo(params, locale, canonicalOrigin, cityNames?)— route searchbuildFlightDetailsSeo(flight, locale, canonicalOrigin)— flight details page
Each returns SeoHeadProps with title, description, canonical, hreflang, og, twitter.
Test strategy: Unit tests with mocked i18n t() function verifying:
- Correct translation keys passed to
t() - Correct interpolation variables
- Canonical URL structure
- Hreflang set included
- OG tags populated
- Twitter card set
T3 — TDD: JSON-LD builder functions (json-ld.ts)
Write tests first in src/features/online-board/json-ld.test.ts, then implement in src/features/online-board/json-ld.ts.
Functions:
buildFlightJsonLd(flight: ISimpleFlight)— returnsschema-dtsFlightthingbuildFlightListJsonLd(flights: ISimpleFlight[], searchDescription: string)— returnsItemList
Test strategy: Unit tests verifying:
- Correct
@typeset - Flight number, departure/arrival airports mapped
- Departure/arrival times mapped
ItemListwraps flights asListItemelements- Type-checks against
schema-dtstypes
T4 — Wire SEO into route pages
Update the 6 route page files to import and use <SeoHead> with appropriate builder + <JsonLdRenderer>. No TDD for this step (visual verification).
src/routes/[lang]/onlineboard/page.tsx— start pagesrc/routes/[lang]/onlineboard/flight/[params]/page.tsx— flight searchsrc/routes/[lang]/onlineboard/departure/[params]/page.tsx— departure searchsrc/routes/[lang]/onlineboard/arrival/[params]/page.tsx— arrival searchsrc/routes/[lang]/onlineboard/route/[params]/page.tsx— route searchsrc/routes/[lang]/onlineboard/[params]/page.tsx— flight details
T5 — Export from barrel
Add SEO + JSON-LD exports to src/features/online-board/index.ts.
T6 — Verify
Run pnpm typecheck && pnpm lint && pnpm test && pnpm build:standalone.
Commit plan
- Commit 1: EN locale SEO keys + SEO builder tests + implementation (
seo.ts) - Commit 2: JSON-LD builder tests + implementation (
json-ld.ts) - Commit 3: Wire SEO into route pages + barrel exports + verify