Files
entscheidomat/components/related-guides.tsx
2026-08-05 19:33:11 +02:00

40 lines
1.2 KiB
TypeScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import Link from "next/link";
import { GUIDES } from "@/lib/guides";
const MAX = 2;
/**
* Zeigt die Ratgeber, die dieses Tool in ihren relatedTools führen.
* Gegenrichtung zum Tool-Link im Ratgeber für kontextbezogenes internes Linking.
*/
export default function RelatedGuides({ toolSlug }: { toolSlug: string }) {
const matching = GUIDES.filter((guide) =>
guide.relatedTools.includes(toolSlug),
).slice(0, MAX);
if (matching.length === 0) return null;
return (
<article className="p-6 sm:p-7 bg-paper/90 rounded-2xl border border-line shadow-soft">
<h2 className="font-display text-xl font-semibold text-ink mb-3">
Passende Ratgeber
</h2>
<ul className="space-y-4">
{matching.map((guide) => (
<li key={guide.slug}>
<Link
href={`/ratgeber/${guide.slug}`}
className="font-medium text-[#c97d60] hover:underline underline-offset-2 transition-colors"
>
{guide.title}
</Link>
<p className="mt-1 text-sm leading-relaxed text-ink-soft">
{guide.excerpt}
</p>
</li>
))}
</ul>
</article>
);
}