diff --git a/src/components/cards/NewsList.astro b/src/components/cards/NewsList.astro index f6f030b..211869c 100644 --- a/src/components/cards/NewsList.astro +++ b/src/components/cards/NewsList.astro @@ -27,7 +27,7 @@ const location = [data.data.city, data.data.state, countryName].filter(Boolean). const newsUrl = `/${locale}/${getLocalizedRoute(routeKey, locale)}/${data.id}`; -const rawContent = content?.body || ""; +const rawContent = data.data?.body || ""; const plainText = rawContent.replace(/^#.*$/gm, "").replace(/^###.*$/gm, "").replace(/\*\*([^*]+)\*\*/g, "$1").replace(/\*([^*]+)\*/g, "$1").replace(/_([^_]+)_/g, "$1").replace(/\[([^\]]+)\]\([^)]+\)/g, "$1").replace(/^>.*$/gm, "").replace(/`[^`]+`/g, "").replace(/^[-*]\s+/gm, "").trim(); const words = plainText.split(/\s+/).filter((w) => w.length > 0).slice(0, 40); const excerpt = words.join(" ") + (words.length === 40 ? "..." : ""); @@ -36,7 +36,7 @@ const excerpt = words.join(" ") + (words.length === 40 ? "..." : "");
- {data.data.title} + {data.data.title}
@@ -52,7 +52,7 @@ const excerpt = words.join(" ") + (words.length === 40 ? "..." : ""); {data.data.tags && data.data.tags.length > 0 && (
{data.data.tags.map((tag: string) => ( - {tag} + {Tag} ))}
)}