--- import { Image } from "astro:assets"; import { Icon } from "astro-icon/components"; import "dayjs/locale/es"; import dayjs from "dayjs"; import utc from "dayjs/plugin/utc"; const regionNames = new Intl.DisplayNames(["es"], { type: "region" }); const locale = Astro.currentLocale; import { createTranslator } from "@/i18n"; const tl = createTranslator(Astro.currentLocale); dayjs.extend(utc); dayjs.locale(locale); const { data, content } = Astro.props; const nicedate = dayjs.utc(data.data.date).format("D MMMM YYYY"); const countryName = data?.data?.country ? regionNames.of(data.data.country) : ""; const locationArray = [data.data.city, data.data.state, countryName]; const location = locationArray.filter(Boolean).join(", "); const newsUrl = `/${locale}/news/${data.id}`; const rawContent = content?.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 ? "..." : ""); ---
{data.data.title}
{nicedate} { location && ( <> | {location} ) }

{data.data.title}

{excerpt}

{ data.data.tags && data.data.tags.length > 0 && (
{data.data.tags.map((tag: string) => ( {tag} ))}
) }
{tl("news.seemore")}