summaryrefslogtreecommitdiff
path: root/website/src/pages
diff options
context:
space:
mode:
authorJoe Carstairs <65492573+Sycamost@users.noreply.github.com>2024-06-05 09:44:18 +0100
committerJoe Carstairs <65492573+Sycamost@users.noreply.github.com>2024-06-05 09:44:18 +0100
commitd7b8cdd1530233604bb0d5bb97209eb214d05cbd (patch)
tree56db5d2baf710111a842b35ce4ed5d970b6ce1c2 /website/src/pages
parentf977ee338c7eff240c26c793d7340de4a7b5788b (diff)
Adds RSS feed for links
Diffstat (limited to 'website/src/pages')
-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',
+ })),
+ })
+}