@@ -3,23 +3,23 @@ import type { APIRoute } from "astro";
33import { getCollection } from "astro:content" ;
44import MarkdownIt from "markdown-it" ;
55import sanitizeHtml from "sanitize-html" ;
6- import { BLOG_DESCRIPTION , BLOG_TITLE } from "../contants " ;
6+ import { BLOG_DESCRIPTION , BLOG_TITLE } from "../constants " ;
77const parser = new MarkdownIt ( ) ;
88
99export const GET : APIRoute = async ( context ) => {
10- const posts = await getCollection ( "docs" ) ;
11-
12- return rss ( {
13- title : BLOG_TITLE ,
14- description : BLOG_DESCRIPTION ,
15- site : context . site ! ,
16- items : posts . map ( ( post ) => ( {
17- ...post . data ,
18- pubDate : post . data . date ?? new Date ( ' 2024-01-07' ) ,
19- link : post . slug === ' index' ? '/' : `/${ post . slug } /` ,
20- content : sanitizeHtml ( parser . render ( post . body ) ) ,
21- ...post . data ,
22- } ) ) ,
23- stylesheet : ' /rss/pretty-feed-v3.xsl' ,
24- } ) ;
25- }
10+ const posts = await getCollection ( "docs" ) ;
11+
12+ return rss ( {
13+ title : BLOG_TITLE ,
14+ description : BLOG_DESCRIPTION ,
15+ site : context . site ! ,
16+ items : posts . map ( ( post ) => ( {
17+ ...post . data ,
18+ pubDate : post . data . date ?? new Date ( " 2024-01-07" ) ,
19+ link : post . slug === " index" ? "/" : `/${ post . slug } /` ,
20+ content : sanitizeHtml ( parser . render ( post . body ) ) ,
21+ ...post . data ,
22+ } ) ) ,
23+ stylesheet : " /rss/pretty-feed-v3.xsl" ,
24+ } ) ;
25+ } ;
0 commit comments