From a9c8d7772a4421eaee63a806fd947fb39743745e Mon Sep 17 00:00:00 2001 From: Joe Carstairs Date: Wed, 5 Jun 2024 17:03:04 +0100 Subject: RSS feeds have better links and render HTML in markdown content --- website/src/pages/links/rss.xml.ts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'website/src/pages/links') diff --git a/website/src/pages/links/rss.xml.ts b/website/src/pages/links/rss.xml.ts index 009588a..3f9e9a0 100644 --- a/website/src/pages/links/rss.xml.ts +++ b/website/src/pages/links/rss.xml.ts @@ -1,6 +1,12 @@ +import path from 'node:path'; import rss from '@astrojs/rss'; import type { APIContext } from 'astro'; import LINKS from '../../data/links.ts'; +import MarkdownIt from 'markdown-it'; + +const mdParser = new MarkdownIt({ + html: true +}); export async function GET(context: APIContext) { // `site` is guaranteed to exist because we define it in our Astro config @@ -13,14 +19,14 @@ export async function GET(context: APIContext) { /images/headshot.webp en-GB `, - site, + site: path.join(site.toString(), 'links'), trailingSlash: false, items: LINKS.map((link) => ({ link: link.href, title: link.title, - content: link.description, + content: mdParser.render(link.description), pubDate: new Date(link.isoDateAdded), - description: link.description, + description: mdParser.render(link.description), author: 'Joe Carstairs', })), }) -- cgit v1.2.3