Added rss feed
This commit is contained in:
parent
5a1d8073b5
commit
c555f1af07
|
@ -25,6 +25,7 @@
|
|||
"vite": "^4.1.4"
|
||||
},
|
||||
"dependencies": {
|
||||
"@astrojs/partytown": "^1.2.0"
|
||||
"@astrojs/partytown": "^1.2.0",
|
||||
"@astrojs/rss": "^2.4.4"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
});
|
||||
}
|
Loading…
Reference in New Issue