Skip to content

Commit

Permalink
update rss.xml.js
Browse files Browse the repository at this point in the history
  • Loading branch information
taoguangc committed Oct 19, 2023
1 parent 849e5a5 commit 52b95ac
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions src/pages/rss.xml.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import rss from '@astrojs/rss';
import { getCollection } from 'astro:content';
import { SITE_TITLE, SITE_DESCRIPTION } from '../consts';
import rss from '@astrojs/rss'
import { getCollection } from 'astro:content'
import { SITE_TITLE, SITE_DESCRIPTION } from '../consts'

export async function GET(context) {
const posts = await getCollection('blog');
return rss({
title: SITE_TITLE,
description: SITE_DESCRIPTION,
site: context.site,
items: posts.map((post) => ({
...post.data,
link: `/blog/${post.slug}/`,
})),
});
const posts = await getCollection('posts')
return rss({
title: SITE_TITLE,
description: SITE_DESCRIPTION,
site: context.site,
items: posts.map((post) => ({
...post.data,
link: `/posts/${post.slug}/`,
})),
})
}

0 comments on commit 52b95ac

Please sign in to comment.