diff options
Diffstat (limited to 'examples/blog/src/pages/rss.xml.js')
-rw-r--r-- | examples/blog/src/pages/rss.xml.js | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/examples/blog/src/pages/rss.xml.js b/examples/blog/src/pages/rss.xml.js index 4e6ed73c4..3997cc45e 100644 --- a/examples/blog/src/pages/rss.xml.js +++ b/examples/blog/src/pages/rss.xml.js @@ -1,10 +1,16 @@ import rss from '@astrojs/rss'; -import { SITE_TITLE, SITE_DESCRIPTION } from '../config'; +import { getCollection } from 'astro:content'; +import { SITE_TITLE, SITE_DESCRIPTION } from '../consts'; -export const get = () => - rss({ +export async function get(context) { + const posts = await getCollection('blog'); + return rss({ title: SITE_TITLE, description: SITE_DESCRIPTION, - site: import.meta.env.SITE, - items: import.meta.glob('./blog/**/*.{md,mdx}'), + site: context.site.href, + items: posts.map((post) => ({ + ...post.data, + link: `/blog/${post.slug}/`, + })), }); +} |