diff --git a/package.json b/package.json index 56da429..e2ec9f4 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "websostenible", "type": "module", - "version": "0.3.4", + "version": "0.3.7", "scripts": { "dev": "astro dev", "devhost": "astro dev --host", diff --git a/src/components/ListadoPostsHorizontal.astro b/src/components/ListadoPostsHorizontal.astro index b10189a..7ff16d6 100644 --- a/src/components/ListadoPostsHorizontal.astro +++ b/src/components/ListadoPostsHorizontal.astro @@ -47,7 +47,4 @@ const posts = await Astro.glob("../pages/posts/*.mdx"); .btn-success { transition: transform 0.3s ease; } - .btn-success:hover { - transform: translateX(5px); - } diff --git a/src/components/PostsRelacionados.astro b/src/components/PostsRelacionados.astro index bcf8e8f..0d066b0 100644 --- a/src/components/PostsRelacionados.astro +++ b/src/components/PostsRelacionados.astro @@ -3,16 +3,25 @@ const { currentPost } = Astro.props; const posts = await Astro.glob('../pages/posts/*.mdx'); -const relatedPosts = posts.filter(post => - currentPost.relacionados?.includes(post.file.split('/').pop().replace('.mdx', '')) -).map(post => ({ - title: post.frontmatter.titulo, - excerpt: post.frontmatter.descripcion, - url: post.url, - imagen: post.frontmatter.imagen +const processedPosts = await Promise.all(posts.map(async (post) => { + const { frontmatter, url, file } = await post; + const fileName = file.split('/').pop().replace('.mdx', '').toLowerCase(); + return { fileName, frontmatter, url }; })); + +const relatedPosts = processedPosts + .filter((post) => + currentPost.relacionados?.map(rel => rel.toLowerCase()).includes(post.fileName) + ) + .map((post) => ({ + title: post.frontmatter?.titulo || 'Sin título', + excerpt: post.frontmatter?.descripcion || '', + url: post.url || '#', + imagen: post.frontmatter?.imagen || '/default-image.jpg', + })); --- +