Added rss feed

This commit is contained in:
Rafael González Vázquez 2023-10-20 17:05:01 -06:00
parent 5a1d8073b5
commit c555f1af07
3 changed files with 567 additions and 525 deletions

View File

@ -25,6 +25,7 @@
"vite": "^4.1.4" "vite": "^4.1.4"
}, },
"dependencies": { "dependencies": {
"@astrojs/partytown": "^1.2.0" "@astrojs/partytown": "^1.2.0",
"@astrojs/rss": "^2.4.4"
} }
} }

21
src/pages/rss.xml.ts Normal file
View File

@ -0,0 +1,21 @@
import rss from "@astrojs/rss";
import type { APIRoute } from "astro";
import { getCollection } from "astro:content";
export const get: APIRoute = async function get({ site }) {
const posts = await getCollection("blog");
const items = posts.map(({ data: { image, title, exerpt, date }, slug }) => ({
title,
exerpt,
link: `${site}${slug}`,
pubDate: new Date(date),
}));
return rss({
title: 'Rafael González | Blog',
description: 'Blog personal de Rafael González, tecnología, e-commerce y más.',
site: site.toString(),
customData: `<language>es-mx</language>`,
items
});
}

1068
yarn.lock

File diff suppressed because it is too large Load Diff