4f2f137b27
payload.ts's mapping functions/types are also imported by "use client" components (LiveTestimonialsGrid, LivePostContent) — importing next/headers anywhere in that module made it unbundlable for the client, breaking the production build. draftMode() is now only ever called in the Server Component pages themselves; they pass the resulting boolean into getPostBySlug/getLegalPage/getTestimonials as a plain `draft` option.
65 lines
2.3 KiB
TypeScript
65 lines
2.3 KiB
TypeScript
import type { Metadata } from "next";
|
||
import { draftMode } from "next/headers";
|
||
import { WeeklyImpulsesHero } from "./components/WeeklyImpulsesHero";
|
||
import { HowItWorks } from "./components/HowItWorks";
|
||
import { WeeklyBenefits } from "./components/WeeklyBenefits";
|
||
import { Newsletter } from "../components/Newsletter";
|
||
import { Footer } from "../components/Footer";
|
||
import { TestimonialsGrid } from "../components/TestimonialsGrid";
|
||
import { LiveTestimonialsGrid } from "../components/LiveTestimonialsGrid";
|
||
import { getTestimonials } from "../lib/payload";
|
||
|
||
const title = "Impulse & Tipps – Wöchentliche Klarheit für deinen Alltag";
|
||
const description =
|
||
"Einmal pro Woche bekommst du konkrete Impulse, die dich wirklich weiterbringen – kurz, praktisch und direkt umsetzbar. Kostenlos, jeden Mittwoch, jederzeit abbestellbar.";
|
||
|
||
export const metadata: Metadata = {
|
||
title,
|
||
description,
|
||
alternates: {
|
||
canonical: "/newsletter",
|
||
},
|
||
openGraph: {
|
||
title,
|
||
description,
|
||
url: "/newsletter",
|
||
images: ["/hero-weekly-impulses.png"],
|
||
},
|
||
twitter: {
|
||
title,
|
||
description,
|
||
images: ["/hero-weekly-impulses.png"],
|
||
},
|
||
};
|
||
|
||
// Route is "/newsletter" — not "/impulse-tipps" or similar — because that
|
||
// path already existed as a dangling link from two places (Navbar's
|
||
// "Newsletter" CTA button and Tools.tsx's "Impulse & Tipps" → "Anmelden"
|
||
// card). Both point at the same underlying thing (signing up for the
|
||
// weekly newsletter), so this page resolves both at once instead of
|
||
// picking a new URL and leaving one of them still dangling.
|
||
export default async function NewsletterPage() {
|
||
const { isEnabled: isPreview } = await draftMode();
|
||
const testimonials = await getTestimonials("newsletter", { draft: isPreview });
|
||
|
||
return (
|
||
<>
|
||
<main className="flex flex-col flex-1">
|
||
<WeeklyImpulsesHero />
|
||
<HowItWorks />
|
||
<WeeklyBenefits />
|
||
{isPreview ? (
|
||
<LiveTestimonialsGrid testimonials={testimonials} />
|
||
) : (
|
||
<TestimonialsGrid testimonials={testimonials} />
|
||
)}
|
||
<Newsletter
|
||
title="Wöchentliche Impulse für mehr Klarheit"
|
||
description="Melde dich jetzt an und erhalte jeden Mittwoch neue Impulse & Tipps direkt in dein Postfach."
|
||
/>
|
||
</main>
|
||
<Footer />
|
||
</>
|
||
);
|
||
}
|