From 3013f352570439832075bab19c9ae91ec6ab98ac Mon Sep 17 00:00:00 2001
From: Ariel Costas Guerrero <94913521+arielcostas@users.noreply.github.com>
Date: Mon, 23 Dec 2024 14:13:29 +0100
Subject: Update to astro 5
---
src/pages/blog/[id].astro | 58 +++++++++++++++++++++++++++++++++++++++++++++
src/pages/blog/[slug].astro | 55 ------------------------------------------
2 files changed, 58 insertions(+), 55 deletions(-)
create mode 100644 src/pages/blog/[id].astro
delete mode 100644 src/pages/blog/[slug].astro
(limited to 'src/pages/blog')
diff --git a/src/pages/blog/[id].astro b/src/pages/blog/[id].astro
new file mode 100644
index 0000000..6488a04
--- /dev/null
+++ b/src/pages/blog/[id].astro
@@ -0,0 +1,58 @@
+---
+import type { GetStaticPaths } from "astro";
+import Layout from "../../layouts/Layout.astro";
+import { getCollection, render } from "astro:content";
+
+export const getStaticPaths = (async () => {
+ const entries = await getCollection("blog");
+ return entries.map((entry) => ({
+ params: { id: entry.id },
+ props: { entry },
+ }));
+}) as GetStaticPaths;
+
+const { entry } = Astro.props;
+const { Content } = await render(entry);
+const formattedDate = new Date(entry.data.publishedAt).toLocaleDateString(
+ "es-ES",
+ {
+ year: "numeric",
+ month: "long",
+ day: "numeric",
+ weekday: "long",
+ },
+);
+
+const schema = {
+ "@context": "https://schema.org",
+ "@type": "BlogPosting",
+ headline: entry.data.title,
+ datePublished: entry.data.publishedAt.toISOString(),
+ author: {
+ "@type": "Person",
+ name: "Ariel Costas Guerrero",
+ },
+ publisher: {
+ "@type": "Person",
+ name: "Ariel Costas Guerrero",
+ logo: {
+ "@type": "ImageObject",
+ url: "https://www.costas.dev/favicon.png",
+ },
+ },
+};
+---
+
+
+
+
+ {entry.data.title}
+
+ Publicado el
+
+
+
+
+
diff --git a/src/pages/blog/[slug].astro b/src/pages/blog/[slug].astro
deleted file mode 100644
index a1a0532..0000000
--- a/src/pages/blog/[slug].astro
+++ /dev/null
@@ -1,55 +0,0 @@
----
-import type { GetStaticPaths } from "astro";
-import Layout from "../../layouts/Layout.astro";
-import { getCollection } from "astro:content";
-export const getStaticPaths = (async () => {
- const entries = await getCollection("blog");
- return entries.map((entry) => ({
- params: { slug: entry.slug },
- props: { entry },
- }));
-}) satisfies GetStaticPaths;
-const { entry } = Astro.props;
-const { Content } = await entry.render();
-const formattedDate = new Date(entry.data.publishedAt).toLocaleDateString(
- "es-ES",
- {
- year: "numeric",
- month: "long",
- day: "numeric",
- weekday: "long",
- },
-);
-const schema = {
- "@context": "https://schema.org",
- "@type": "BlogPosting",
- headline: entry.data.title,
- datePublished: entry.data.publishedAt.toISOString(),
- author: {
- "@type": "Person",
- name: "Ariel Costas Guerrero",
- },
- publisher: {
- "@type": "Person",
- name: "Ariel Costas Guerrero",
- logo: {
- "@type": "ImageObject",
- url: "https://www.costas.dev/favicon.png",
- },
- },
-};
----
-
-
-
-
- {entry.data.title}
-
- Publicado el
-
-
-
-
-
--
cgit v1.3