mirror of
https://github.com/ClovertaTheTrilobita/SanYeCao-blog.git
synced 2026-04-02 01:54:50 +00:00
update rss
This commit is contained in:
parent
3a505c3ce9
commit
fc599520a3
1 changed files with 11 additions and 2 deletions
|
|
@ -1,11 +1,20 @@
|
|||
import rss, { pagesGlobToRssItems } from '@astrojs/rss';
|
||||
import rss from '@astrojs/rss';
|
||||
import { pagesGlobToRssItems } from '@astrojs/rss';
|
||||
import { getCollection } from 'astro:content';
|
||||
|
||||
export async function GET(context) {
|
||||
const posts = await getCollection("blog");
|
||||
return rss({
|
||||
title: 'Astro Learner | Blog',
|
||||
description: 'My journey learning Astro',
|
||||
site: context.site,
|
||||
items: await pagesGlobToRssItems(import.meta.glob('./**/*.md')),
|
||||
items: posts.map((post) => ({
|
||||
title: post.data.title,
|
||||
pubDate: post.data.pubDate,
|
||||
description: post.data.description,
|
||||
link: `/posts/${post.id}/`,
|
||||
})),
|
||||
customData: `<language>en-us</language>`,
|
||||
});
|
||||
})
|
||||
}
|
||||
Loading…
Reference in a new issue