From a2830a0dd6f634147456406c7855881ff298078e Mon Sep 17 00:00:00 2001 From: Ariel Costas Guerrero Date: Thu, 5 Jun 2025 20:03:27 +0200 Subject: Refresh portfolio design and fonts --- src/layouts/BlogListLayout.astro | 325 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 325 insertions(+) create mode 100644 src/layouts/BlogListLayout.astro (limited to 'src/layouts/BlogListLayout.astro') diff --git a/src/layouts/BlogListLayout.astro b/src/layouts/BlogListLayout.astro new file mode 100644 index 0000000..4ad72ea --- /dev/null +++ b/src/layouts/BlogListLayout.astro @@ -0,0 +1,325 @@ +--- +import { getCollection } from "astro:content"; +import Layout from "@/layouts/Layout.astro"; + +const blogCollection = (await getCollection("blog")).sort((a, b) => { + return b.data.publishedAt.getTime() - a.data.publishedAt.getTime(); +}); + +// Agrupar artículos por fecha +const groupedPosts = blogCollection.reduce( + (acc: Record, post) => { + const year = post.data.publishedAt.getFullYear(); + const month = post.data.publishedAt.getMonth() + 1; + const key = `${year}-${month}`; + if (!acc[key]) { + acc[key] = []; + } + acc[key].push(post); + return acc; + }, + {}, +); + +// Colección de todas las etiquetas únicas +const allTags = [...new Set(blogCollection.flatMap(post => post.data.tags || []))].sort(); + +function humaniseDate(date: Date) { + const result = date.toLocaleDateString("es-ES", { + month: "long", + year: "numeric", + }); + return result.charAt(0).toUpperCase() + result.slice(1); +} + +const schema = { + "@context": "https://schema.org", + "@type": "Blog", + headline: "Blog de Ariel Costas", + description: + "En este blog encontrarás artículos sobre desarrollo, tecnología y otras temáticas que pueda querer compartir. Disclaimer de siempre: las opiniones son mías, y no representan a ninguna empresa o institución.", + publisher: { + "@type": "Person", + name: "Ariel Costas Guerrero", + url: "https://www.costas.dev", + }, + author: { + "@type": "Person", + name: "Ariel Costas Guerrero", + url: "https://www.costas.dev", + }, +}; +--- + + + + + + -- cgit v1.3