diff options
| author | Ariel Costas Guerrero <94913521+arielcostas@users.noreply.github.com> | 2024-08-21 10:10:38 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-08-21 10:10:38 +0200 |
| commit | dd23cbd8a1caf00f0b842aff514d2907d545a403 (patch) | |
| tree | 8fe6ba45871480f4fd352e567cae0b66ca4ccd04 /src/pages/index.astro | |
| parent | 553f8739ebd00110f649ce10440f1029766725a7 (diff) | |
Bring back the blog
Diffstat (limited to 'src/pages/index.astro')
| -rw-r--r-- | src/pages/index.astro | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/src/pages/index.astro b/src/pages/index.astro index 0f92a2d..5d1c24d 100644 --- a/src/pages/index.astro +++ b/src/pages/index.astro @@ -2,6 +2,10 @@ 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(); +}); + const schema = { "@context": "http://schema.org", "@type": "WebSite", @@ -29,6 +33,7 @@ const schema = { su conocimiento. Me gusta la programación, el diseño web y la creatividad. Me encanta crear cosas nuevas y aprender de los demás. </p> + <a href="/trajectory">Más información sobre mí</a> <h2>¿Qué hago?</h2> <p> @@ -36,6 +41,28 @@ const schema = { Cloud en una empresa de tecnología. Me encargo de desarrollar aplicaciones web en PHP y desplegarlas en la nube de forma segura y eficiente. </p> - <a href="/portfolio">Mi portfolio</a> + + <h2>Últimas entradas del blog</h2> + <ul> + { + blogCollection.slice(0, 5).map((p) => { + const date = Intl.DateTimeFormat("es-ES", { + day: "2-digit", + month: "short", + year: "numeric", + }).format(p.data.publishedAt); + return ( + <li> + <time datetime={p.data.publishedAt.toISOString()}> + {date} + </time> + <a href={`/blog/${p.slug}`}>{p.data.title}</a> + </li> + ); + }) + } + </ul> + <a href="/blog">Ver todas las entradas</a> + </Layout> |
