Commit 37bcbcf

HPCesia <me@hpcesia.com>
2025-06-07 13:58:11
feat(rss): use astro rendered html instead of markdown-it
1 parent ab178f4
Changed files (1)
src
src/pages/rss.xml.ts
@@ -2,11 +2,8 @@ import { siteConfig } from '@/config';
 import rss from '@astrojs/rss';
 import { getSortedPosts } from '@utils/content-utils';
 import type { APIRoute } from 'astro';
-import MarkdownIt from 'markdown-it';
 import sanitizeHtml from 'sanitize-html';
 
-const parser = new MarkdownIt();
-
 export const GET: APIRoute = async function (context) {
   const posts = await getSortedPosts();
   return rss({
@@ -18,9 +15,7 @@ export const GET: APIRoute = async function (context) {
       pubDate: post.data.published,
       description: post.data.description,
       link: `/posts/${post.data.slug}`,
-      content: sanitizeHtml(parser.render(post.body || ''), {
-        allowedTags: sanitizeHtml.defaults.allowedTags.concat(['img']),
-      }),
+      content: sanitizeHtml(post.rendered?.html || ''),
     })),
   });
 };