Fall back to newsletter CTA when a post has no related product
The "Passend dazu" slot went empty for most posts (only 1 of 12 has relatedProduct set), leaving /newsletter with no incoming link anywhere on the site despite being a fully built page. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013Eg6h91yngXmSnM51wxXM8
This commit is contained in:
+51
-10
@@ -125,16 +125,21 @@ export default async function BlogDetailPage({
|
||||
|
||||
<Reveal delay={0.15} className="flex flex-col gap-6 w-full max-w-[48rem] mx-auto px-[var(--layout-padding-x)] pb-10">
|
||||
{/* "Passend dazu" — per-post CMS content now (Posts.relatedProduct),
|
||||
not a hardcoded flagship-product link. Hidden entirely if the
|
||||
post has no related product, or that product has no detail
|
||||
page to send "Entdecken" to. Matches the actual built Figma
|
||||
frame exactly (node 4674:349, fetched via get_design_context) —
|
||||
1px border-border, rounded-md, px-9/py-7 padding; an earlier
|
||||
version guessed a plain borderless row instead, which
|
||||
get_metadata's structural dump didn't reveal (frame-level
|
||||
stroke/padding/radius aren't visible there, only
|
||||
get_design_context shows those). */}
|
||||
{post.relatedProduct?.href && (
|
||||
not a hardcoded flagship-product link. If the post has no
|
||||
related product (or that product has no detail page to send
|
||||
"Entdecken" to), falls back to a "Nicht verpassen" newsletter
|
||||
card instead of leaving this slot empty — /newsletter had no
|
||||
incoming link anywhere in the site despite being a fully
|
||||
built page (WERKZEUGE_ROUTES and TestimonialsPage already
|
||||
treated it as a first-class destination), and blog readers
|
||||
are exactly its target audience. Matches the actual built
|
||||
Figma frame exactly (node 4674:349, fetched via
|
||||
get_design_context) — 1px border-border, rounded-md,
|
||||
px-9/py-7 padding; an earlier version guessed a plain
|
||||
borderless row instead, which get_metadata's structural dump
|
||||
didn't reveal (frame-level stroke/padding/radius aren't
|
||||
visible there, only get_design_context shows those). */}
|
||||
{post.relatedProduct?.href ? (
|
||||
<Link
|
||||
href={post.relatedProduct.href}
|
||||
className="group flex items-center gap-4 sm:gap-6 border border-border rounded-md px-5 py-5 sm:px-9 sm:py-7 hover:border-brand transition-colors"
|
||||
@@ -178,6 +183,42 @@ export default async function BlogDetailPage({
|
||||
</div>
|
||||
</div>
|
||||
</Link>
|
||||
) : (
|
||||
<Link
|
||||
href="/newsletter"
|
||||
className="group flex items-center gap-4 sm:gap-6 border border-border rounded-md px-5 py-5 sm:px-9 sm:py-7 hover:border-brand transition-colors"
|
||||
>
|
||||
<div className="relative w-16 h-[4.6875rem] shrink-0 rounded-sm overflow-hidden">
|
||||
<Image alt="" src="/weekly-photo.png" fill sizes="64px" className="object-cover" />
|
||||
</div>
|
||||
<div className="flex-1 min-w-0 flex flex-col gap-2.5">
|
||||
<p className="font-bold text-[0.8125rem] text-brand">Nicht verpassen:</p>
|
||||
<div className="flex flex-col sm:flex-row sm:items-end sm:justify-between gap-4 w-full">
|
||||
<div className="flex flex-col gap-2 items-start w-full sm:w-[19rem] sm:shrink-0">
|
||||
<p
|
||||
className="font-semibold text-[1.375rem] text-text-primary sm:whitespace-nowrap"
|
||||
style={{ fontFamily: "var(--font-lora)" }}
|
||||
>
|
||||
Wöchentliche Impulse
|
||||
</p>
|
||||
<p className="text-[0.9375rem] text-text-muted leading-[1.45]">
|
||||
Jeden Mittwoch neue Denkanstöße direkt ins Postfach – kostenlos, jederzeit abbestellbar.
|
||||
</p>
|
||||
</div>
|
||||
<span className="flex items-center gap-1.5 font-bold text-[0.875rem] text-text-primary whitespace-nowrap mt-1 sm:mt-0">
|
||||
Abonnieren
|
||||
<svg
|
||||
viewBox="0 0 20 20"
|
||||
className="size-3.5 transition-transform duration-200 group-hover:translate-x-1"
|
||||
fill="none"
|
||||
aria-hidden="true"
|
||||
>
|
||||
<path d="M4 10h12m0 0-5-5m5 5-5 5" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" />
|
||||
</svg>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</Link>
|
||||
)}
|
||||
</Reveal>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user