File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -28,5 +28,10 @@ const today = new Date();
2828 rel =" noreferrer noopener" >LinkedIn</SnsIcon
2929 >
3030 </li >
31+ <li >
32+ <SnsIcon href =" /rss.xml" target =" _blank" rel =" noreferrer noopener"
33+ >RSS</SnsIcon
34+ >
35+ </li >
3136 </ul >
3237</footer >
Original file line number Diff line number Diff line change 1+ import rss from '@astrojs/rss' ;
2+ import type { APIContext } from 'astro' ;
3+ import { getCollection } from 'astro:content' ;
4+
5+ export async function GET ( context : APIContext ) {
6+ const posts = ( await getCollection ( 'blog' ) ) . sort (
7+ ( a , b ) => b . data . pubDate . valueOf ( ) - a . data . pubDate . valueOf ( )
8+ ) ;
9+ return rss ( {
10+ title : 'devwqc blog' ,
11+ description : '저의 경험을 이야기하는 블로그입니다.' ,
12+ site : context . site || 'https://devwqc.github.io/' ,
13+ items : posts . map ( ( post ) => ( {
14+ ...post . data ,
15+ link : `/blog/${ post . slug } /` ,
16+ } ) ) ,
17+ } ) ;
18+ }
You can’t perform that action at this time.
0 commit comments