summaryrefslogtreecommitdiff
path: root/website
diff options
context:
space:
mode:
Diffstat (limited to 'website')
-rw-r--r--website/src/pages/links/rss.xml.ts27
1 files changed, 27 insertions, 0 deletions
diff --git a/website/src/pages/links/rss.xml.ts b/website/src/pages/links/rss.xml.ts
new file mode 100644
index 0000000..009588a
--- /dev/null
+++ b/website/src/pages/links/rss.xml.ts
@@ -0,0 +1,27 @@
+import rss from '@astrojs/rss';
+import type { APIContext } from 'astro';
+import LINKS from '../../data/links.ts';
+
+export async function GET(context: APIContext) {
+ // `site` is guaranteed to exist because we define it in our Astro config
+ const site = context.site!;
+
+ return rss({
+ title: 'Joe Carstairs’ links',
+ description: 'An assortment of links I’m accumulating.',
+ customData: `
+ <image>/images/headshot.webp</image>
+ <language>en-GB</language>
+ `,
+ site,
+ trailingSlash: false,
+ items: LINKS.map((link) => ({
+ link: link.href,
+ title: link.title,
+ content: link.description,
+ pubDate: new Date(link.isoDateAdded),
+ description: link.description,
+ author: 'Joe Carstairs',
+ })),
+ })
+}