feat(layout): add global announcement banner above nav
Adds AnnouncementBanner component fed by a new top_banner CMS entry (site-announcement). Extended top_banner schema and TS types with optional link + linkLabel fields. Rendered inline-markdown text. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -15,6 +15,7 @@ import type {
|
||||
NavigationEntry,
|
||||
FooterEntry,
|
||||
PageConfigEntry,
|
||||
TopBannerEntry,
|
||||
} from '$lib/cms';
|
||||
import { ensureTransformedImage } from '$lib/rusty-image';
|
||||
import {
|
||||
@@ -84,6 +85,7 @@ export const load: LayoutServerLoad = async ({ locals, route }) => {
|
||||
let bootstrapNavSocial: NavigationEntry | null = null;
|
||||
let bootstrapFooter: FooterEntry | null = null;
|
||||
let bootstrapConfig: PageConfigEntry | null = null;
|
||||
let bootstrapTopBanner: TopBannerEntry | null = null;
|
||||
try {
|
||||
const batch = await batchFetch([
|
||||
{
|
||||
@@ -114,11 +116,17 @@ export const load: LayoutServerLoad = async ({ locals, route }) => {
|
||||
locale: 'de',
|
||||
resolve: 'logo',
|
||||
},
|
||||
{
|
||||
id: 'topBanner',
|
||||
collection: 'top_banner',
|
||||
slug: 'site-announcement',
|
||||
},
|
||||
]);
|
||||
bootstrapNavHeader = batchData<NavigationEntry>(batch.results.navHeader);
|
||||
bootstrapNavSocial = batchData<NavigationEntry>(batch.results.navSocial);
|
||||
bootstrapFooter = batchData<FooterEntry>(batch.results.footer);
|
||||
bootstrapConfig = batchData<PageConfigEntry>(batch.results.config);
|
||||
bootstrapTopBanner = batchData<TopBannerEntry>(batch.results.topBanner);
|
||||
} catch (err) {
|
||||
/* CMS nicht erreichbar — alle Felder bleiben null, Page rendert ohne. */
|
||||
logWarn('layout.bootstrap', err);
|
||||
@@ -328,5 +336,6 @@ export const load: LayoutServerLoad = async ({ locals, route }) => {
|
||||
seoDescriptionTemplate: pageConfig?.seoDescription ?? null,
|
||||
analyticsPm86SiteId:
|
||||
(pageConfig as { analyticsPm86SiteId?: string } | null)?.analyticsPm86SiteId ?? null,
|
||||
announcementBanner: bootstrapTopBanner,
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user