File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -22,11 +22,9 @@ export async function generateRssFeed(type: 'rss' | 'atom' | 'json' = 'rss') {
2222 favicon : `${ site_url } /favicon.ico` ,
2323 copyright : `CC-BY 4.0 ${ new Date ( ) . getFullYear ( ) } , Center of Trial and Error` ,
2424 generator : 'Feed for Node.js' ,
25+
2526 feedLinks : {
2627 rss2 : `/rss.xml` ,
27- // // other feed formats
28- // json: `/rss.json`,
29- // atom: `/rss.xml`,
3028 } ,
3129 }
3230
@@ -82,17 +80,13 @@ export async function generateRssFeed(type: 'rss' | 'atom' | 'json' = 'rss') {
8280 : { } ) ,
8381 } )
8482 } )
85- feed . addExtension ( { } )
8683
87- if ( type === 'rss' ) {
88- return feed . rss2 ( )
89- }
84+ const feedString = feed . rss2 ( )
9085
91- // if (type === 'atom') {
92- // return feed.atom1()
93- // }
86+ const feedstringWithCorrectXml = feedString . replace (
87+ / ( < r s s .* ) > / ,
88+ '$1 xmlns:media="http://search.yahoo.com/mrss/"' ,
89+ )
9490
95- // if (type === 'json') {
96- // return feed.json1()
97- // }
91+ return feedstringWithCorrectXml
9892}
You can’t perform that action at this time.
0 commit comments