mirror of
https://github.com/rjNemo/orbital-orbit
synced 2026-06-06 06:56:40 +00:00
refactor: update the rss to use collections too
This commit is contained in:
parent
5acac485c7
commit
c58ee4ddfa
1 changed files with 7 additions and 1 deletions
|
|
@ -1,11 +1,17 @@
|
||||||
import rss, { pagesGlobToRssItems } from "@astrojs/rss";
|
import rss, { pagesGlobToRssItems } from "@astrojs/rss";
|
||||||
|
import { getCollection } from "astro:content";
|
||||||
|
|
||||||
export async function GET(context) {
|
export async function GET(context) {
|
||||||
return rss({
|
return rss({
|
||||||
title: "Astro Learner | Blog",
|
title: "Astro Learner | Blog",
|
||||||
description: "My journey learning Astro",
|
description: "My journey learning Astro",
|
||||||
site: context.site,
|
site: context.site,
|
||||||
items: await pagesGlobToRssItems(import.meta.glob("./**/*.md")),
|
items: (await getCollection("blog")).map((post) => ({
|
||||||
|
title: post.data.title,
|
||||||
|
pubDate: post.data.pubDate,
|
||||||
|
description: post.data.description,
|
||||||
|
link: `/blog/${post.id}`,
|
||||||
|
})),
|
||||||
customData: `<language>en-us</language>`,
|
customData: `<language>en-us</language>`,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue