1
1
import get_posts from '../api/blog/_posts.js' ;
2
2
3
- const months = ',Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec' . split ( ',' ) ;
3
+ const months = ',Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec' . split ( ',' ) ;
4
4
5
- function formatPubdate ( str ) {
6
- const [ y , m , d ] = str . split ( '-' ) ;
7
- return `${ d } ${ months [ + m ] } ${ y } ` ;
5
+ function formatPubdate ( str ) {
6
+ const [ y , m , d ] = str . split ( '-' ) ;
7
+ return `${ d } ${ months [ + m ] } ${ y } 12:00 +0000 ` ;
8
8
}
9
9
10
10
const rss = `
@@ -20,23 +20,23 @@ const rss = `
20
20
<title>Svelte</title>
21
21
<link>https://svelte.technology/blog</link>
22
22
</image>
23
- ${ get_posts ( ) . map ( post => `
23
+ ${ get_posts ( ) . map ( post => `
24
24
<item>
25
25
<title>${ post . metadata . title } </title>
26
26
<link>https://svelte.technology/blog/${ post . slug } </link>
27
27
<description>${ post . metadata . description } </description>
28
28
<pubDate>${ formatPubdate ( post . metadata . pubdate ) } </pubDate>
29
29
</item>
30
- ` ) }
30
+ ` ) . join ( '' ) }
31
31
</channel>
32
32
33
33
</rss>
34
- ` . replace ( / > [ ^ \S ] + / gm, '>' ) . replace ( / [ ^ \S ] + < / gm, '<' ) . trim ( ) ;
34
+ ` . replace ( / > [ ^ \S ] + / gm, '>' ) . replace ( / [ ^ \S ] + < / gm, '<' ) . trim ( ) ;
35
35
36
36
export function get ( req , res ) {
37
37
res . set ( {
38
38
'Cache-Control' : `max-age=${ 30 * 60 * 1e3 } ` ,
39
39
'Content-Type' : 'application/rss+xml'
40
40
} ) ;
41
41
res . end ( rss ) ;
42
- }
42
+ }
0 commit comments