797d9d42fe
RichText.tsx switched to Payload's official React renderer + custom JSXConverters (same call signature, LiveRichText/LivePostContent untouched) — needed to render the new Lexical Blocks the Payload repo's Posts.content just gained. Converters follow the existing CMS-image convention (relative + aspect-[...] + fill + object-cover); the video block resolves YouTube/Vimeo links to an iframe embed. New getSeoSettings() fetcher (same pattern as getKleinunternehmer()), app/layout.tsx now generateMetadata() reading it with the same fallback values it used to hardcode. Per-post SEO overrides (seoTitle/ seoDescription/seoImage) wired into the blog detail page's metadata, falling back to title/excerpt/thumbnail when empty. Also fixed while auditing every page's metadata: missing descriptions on 3 konto pages, a static title on the dynamic order-detail route, and missing OG images on /shop and /blog.
87 lines
2.6 KiB
TypeScript
87 lines
2.6 KiB
TypeScript
import type { Metadata } from "next";
|
|
import { Inter, Playfair_Display, Caveat, Lora } from "next/font/google";
|
|
import "./globals.css";
|
|
import { Navbar } from "./components/Navbar";
|
|
import { CartFlyProvider } from "./components/CartFly";
|
|
import { CartSync } from "./components/CartSync";
|
|
import { getProducts, getSeoSettings } from "./lib/payload";
|
|
|
|
const inter = Inter({
|
|
variable: "--font-inter",
|
|
subsets: ["latin"],
|
|
weight: ["400", "500", "600", "700"],
|
|
});
|
|
|
|
const playfair = Playfair_Display({
|
|
variable: "--font-playfair",
|
|
subsets: ["latin"],
|
|
weight: ["600", "700", "800"],
|
|
});
|
|
|
|
const caveat = Caveat({
|
|
variable: "--font-caveat",
|
|
subsets: ["latin"],
|
|
weight: ["700"],
|
|
});
|
|
|
|
const lora = Lora({
|
|
variable: "--font-lora",
|
|
subsets: ["latin"],
|
|
weight: ["400", "600"],
|
|
});
|
|
|
|
// Backend-driven since 2026-07-24 (CompanySettings' "SEO" tab) — the
|
|
// literal strings below are only the fallback getSeoSettings() returns if
|
|
// that field is empty or unreachable, kept identical to what used to be
|
|
// hardcoded here so nothing changes until an admin actually fills in the
|
|
// new fields.
|
|
export async function generateMetadata(): Promise<Metadata> {
|
|
const seo = await getSeoSettings();
|
|
return {
|
|
metadataBase: new URL("https://einfach-produktiv.mk360.de"),
|
|
title: {
|
|
default: seo.defaultTitle ?? "einfach produktiv.",
|
|
template: seo.titleTemplate ?? "%s | einfach produktiv.",
|
|
},
|
|
description: seo.defaultDescription ?? undefined,
|
|
openGraph: {
|
|
siteName: "einfach produktiv.",
|
|
locale: "de_DE",
|
|
type: "website",
|
|
images: seo.defaultOgImage ? [{ url: seo.defaultOgImage }] : undefined,
|
|
},
|
|
twitter: {
|
|
card: "summary_large_image",
|
|
images: seo.defaultOgImage ? [seo.defaultOgImage] : undefined,
|
|
},
|
|
};
|
|
}
|
|
|
|
export default async function RootLayout({
|
|
children,
|
|
}: Readonly<{
|
|
children: React.ReactNode;
|
|
}>) {
|
|
// Same 60s-ISR-cached call every other page already makes — reused here
|
|
// just to know whether Navbar's "Shop" link should behave as an anchor
|
|
// to the homepage spotlight instead of a real /shop navigation (see
|
|
// Navbar.tsx/ProductSpotlight.tsx).
|
|
const products = await getProducts();
|
|
const singleActiveProduct = products.filter((p) => p.active).length === 1;
|
|
|
|
return (
|
|
<html
|
|
lang="de"
|
|
className={`${inter.variable} ${playfair.variable} ${caveat.variable} ${lora.variable} h-full antialiased scroll-smooth`}
|
|
>
|
|
<body className="min-h-full flex flex-col">
|
|
<CartFlyProvider>
|
|
<CartSync />
|
|
<Navbar singleActiveProduct={singleActiveProduct} />
|
|
{children}
|
|
</CartFlyProvider>
|
|
</body>
|
|
</html>
|
|
);
|
|
}
|