From dd23cbd8a1caf00f0b842aff514d2907d545a403 Mon Sep 17 00:00:00 2001
From: Ariel Costas Guerrero <94913521+arielcostas@users.noreply.github.com>
Date: Wed, 21 Aug 2024 10:10:38 +0200
Subject: Bring back the blog
---
src/pages/blog.astro | 68 +++++++++++++++++++++++++++++++++++++++++++++
src/pages/blog.xml.js | 19 +++++++++++++
src/pages/blog/[slug].astro | 55 ++++++++++++++++++++++++++++++++++++
src/pages/index.astro | 29 ++++++++++++++++++-
4 files changed, 170 insertions(+), 1 deletion(-)
create mode 100644 src/pages/blog.astro
create mode 100644 src/pages/blog.xml.js
create mode 100644 src/pages/blog/[slug].astro
(limited to 'src/pages')
diff --git a/src/pages/blog.astro b/src/pages/blog.astro
new file mode 100644
index 0000000..4cfcea3
--- /dev/null
+++ b/src/pages/blog.astro
@@ -0,0 +1,68 @@
+---
+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 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;
+ },
+ {},
+);
+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",
+ },
+ "author": {
+ "@type": "Person",
+ "name": "Ariel Costas",
+ }
+};
+---
+
+
+
+
+
Blog de Ariel Costas
+
+
+ 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.
+
@@ -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.