From 97c1e8da0c8a73ef5289b930b5c12745912ada7f Mon Sep 17 00:00:00 2001 From: Ariel Costas Guerrero <94913521+arielcostas@users.noreply.github.com> Date: Tue, 18 Jun 2024 16:44:54 +0200 Subject: Deprecate blog and mastodon link --- src/pages/blog.astro | 72 --------------------------------------------- src/pages/blog.xml.js | 19 ------------ src/pages/blog/[slug].astro | 59 ------------------------------------- 3 files changed, 150 deletions(-) delete mode 100644 src/pages/blog.astro delete mode 100644 src/pages/blog.xml.js delete mode 100644 src/pages/blog/[slug].astro (limited to 'src/pages') diff --git a/src/pages/blog.astro b/src/pages/blog.astro deleted file mode 100644 index e533fb6..0000000 --- a/src/pages/blog.astro +++ /dev/null @@ -1,72 +0,0 @@ ---- -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. -

- - { - Object.entries(groupedPosts).map(([key, posts]) => ( -
-

{humaniseDate(new Date(key))}

- -
- )) - } -
diff --git a/src/pages/blog.xml.js b/src/pages/blog.xml.js deleted file mode 100644 index ec8d424..0000000 --- a/src/pages/blog.xml.js +++ /dev/null @@ -1,19 +0,0 @@ -import rss from '@astrojs/rss'; -import { getCollection } from 'astro:content'; - - -export async function GET(context) { - const collection = await getCollection('blog'); - - return rss({ - title: "Blog de Ariel Costas", - description: "Artículos del blog de Ariel Costas", - site: context.site, - items: collection.map((post) => ({ - title: post.data.title, - link: `${context.site}blog/${post.slug}`, - description: post.data.metaDescription, - pubDate: post.data.publishedAt - })) - }) -} \ No newline at end of file diff --git a/src/pages/blog/[slug].astro b/src/pages/blog/[slug].astro deleted file mode 100644 index f9ceec1..0000000 --- a/src/pages/blog/[slug].astro +++ /dev/null @@ -1,59 +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