Created
June 20, 2023 13:40
-
-
Save blackspike/60284b5617f5e446024e0d776f6152ff to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import rss from "@astrojs/rss" | |
import { getCollection } from "astro:content" | |
export async function get(context) { | |
const blog = await getCollection("blog") | |
return rss({ | |
title: "blackspike blog", | |
description: "thoughts from blackspike", | |
site: context.site, | |
stylesheet: "/rss-styles.xsl", | |
items: blog | |
.filter((post) => !post.data.draft) | |
.sort((a, b) => a.data.date - b.data.date) | |
.reverse() | |
.map((post) => ({ | |
title: post.data.title, | |
pubDate: post.data.date, | |
description: post.data.description, | |
link: `/blog/${post.slug}/`, | |
})), | |
}) | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment