--- type Props = { href?: string; title: string; summary?: string; imageUrl?: string; dateLabel?: string; viewsLabel?: string; sourceLabel: string; isExternal?: boolean; linkAttrs?: Record; mode?: "link" | "modal"; }; const { href, title, summary, imageUrl, dateLabel, viewsLabel, sourceLabel, isExternal, linkAttrs, mode = "link", } = Astro.props; function truncate(s: string, n: number) { const t = (s || "").trim(); if (!t) return ""; if (t.length <= n) return t; // ASCII ellipsis to avoid encoding issues in generated HTML. return `${t.slice(0, Math.max(0, n - 3)).trimEnd()}...`; } const summaryText = truncate(summary || "", 180); const Element = mode === "modal" ? "button" : "a"; const elementProps = mode === "modal" ? { type: "button", ...linkAttrs } : { href, target: isExternal ? "_blank" : undefined, rel: isExternal ? "noopener noreferrer" : undefined, ...linkAttrs }; ---
{imageUrl ? (
) : (
)}

{title}

{summaryText ?

{summaryText}

: null}