feat(static-pages): extend data model with route/enabled/status/media/SEO
Milestone 1 of the Static Pages Module sprint. - StaticPageConfig / ContentPage / ContentPageBootstrapInput gain: explicit editable route (defaults from slug, independently overridable), enabled (master on/off), status: 'draft'|'published' (per-page publish lifecycle, independent of the whole-bootstrap draft/publish cycle), customTemplate, heroImage/thumbnail/gallery, and seo.robots. - ContentPageService: normalizePage/normalizePages default missing enabled/status to enabled+published so existing bootstrap data never gets silently un-published; only the editor's createPage() opts a brand-new page into 'draft'. Legacy array-format pages get the same treatment. - resolvePage now returns null (storefront 404) for a disabled or draft page, regardless of whether the surrounding bootstrap itself is published - affects the storefront static-page route AND the auto-generated footer nav group (both go through this same resolver), which is the correct behavior. - validatePages extended: duplicateRoutes (route can now diverge from slug), invalidHtml, invalidSeo (canonical/ogImage URL shape, known robots tokens). - New schema/validators/primitives.validateHtml: stack-based tag-balance check (void/self-closing elements skipped, comments stripped). Caught and fixed a real bug during its own spec run: the initial implementation popped the stack back to the nearest matching ancestor on a mismatched closing tag, which silently swallowed a genuinely unclosed inner tag instead of flagging it - now a closing tag must match the top of the stack exactly. - toBootstrapRecord serializes the new fields; visible mirrors enabled so any reader of the older field name stays truthful. - Specs: content-page.service.spec.ts (new), primitives.spec.ts (validateHtml). Gate: tsc --noEmit, npm test (57/57), arch:check, build all green. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -28,6 +28,7 @@ export interface StaticPageTranslationConfig {
|
||||
ogTitle?: string;
|
||||
ogDescription?: string;
|
||||
ogImage?: string;
|
||||
robots?: string;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -53,6 +54,14 @@ export interface StaticPageConfig {
|
||||
visible?: boolean;
|
||||
route?: string;
|
||||
content?: LocalizedHtmlContent;
|
||||
/** Master on/off switch. Kept in sync with `visible` on serialize; a disabled page never resolves on the storefront regardless of `status`. */
|
||||
enabled?: boolean;
|
||||
/** Per-page publish lifecycle, independent of the whole-bootstrap draft/publish cycle. A `draft` page never resolves on the storefront even when the surrounding bootstrap is published. */
|
||||
status?: 'draft' | 'published';
|
||||
customTemplate?: string;
|
||||
heroImage?: string;
|
||||
thumbnail?: string;
|
||||
gallery?: string[];
|
||||
}
|
||||
|
||||
export interface LegacyStaticPageConfig {
|
||||
@@ -84,4 +93,8 @@ export interface ResolvedStaticPage {
|
||||
ogImage?: string;
|
||||
robots?: string;
|
||||
};
|
||||
customTemplate?: string;
|
||||
heroImage?: string;
|
||||
thumbnail?: string;
|
||||
gallery?: string[];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user