--- import { getCollection, render } from 'astro:content'; import RelatedPosts from "../../components/PostsRelacionados.astro"; // Componente para posts relacionados import Navbar from "../../components/Navbar.astro"; import Footer from "../../components/Footer.astro"; // 1. Generate a new path for every collection entry export async function getStaticPaths() { const posts = await getCollection('posts'); return posts.map(post => ({ params: { id: post.id }, props: { post }, })); } // 2. For your template, you can get the entry directly from the prop const { post } = Astro.props; const { Content } = await render(post); const cleaned = post.filePath.replace(/^src\/posts\//, "").replace(/\.mdx$/, ""); const postMD = await import(`../../posts/${cleaned}.mdx`); const headings = postMD.getHeadings(); const description = post.data.descripcion; // URLs para compartir en redes sociales const shareUrl = new URL(Astro.url.pathname, Astro.site).toString(); const facebookShareUrl = `https://www.facebook.com/sharer/sharer.php?u=${encodeURIComponent(shareUrl)}`; const twitterShareUrl = `https://twitter.com/intent/tweet?url=${encodeURIComponent(shareUrl)}&text=${encodeURIComponent(post.titulo)}`; const linkedinShareUrl = `https://www.linkedin.com/shareArticle?mini=true&url=${encodeURIComponent(shareUrl)}&title=${encodeURIComponent(post.titulo)}`; const blogJsonLd = { "@context": "https://schema.org", "@type": "BlogPosting", "headline": post.data.titulo, "image": post.data.imagen && new URL(post.data.imagen, Astro.site), "datePublished": post.data.fecha, "dateModified": post.data.fecha, "author": { "@type": "Person", "name": post.data.autor }, "publisher": { "@type": "Organization", "name": "Ecobjetivos", "logo": { "@type": "ImageObject", "url": new URL('/logo.png', Astro.site) } }, "description": description }; ---