@@ -8,12 +8,16 @@ const configFile = readFileSync(`${process.cwd()}/rss.config.json`, 'utf8');
88const config = JSON . parse ( configFile . toString ( ) ) ;
99const blogPostRouteSlug = config . blogPostRouteSlug || '/blog' ;
1010const feed = new Feed ( config ) ;
11+
12+ const { log, yellow } = require ( '@scullyio/scully' ) ;
13+
1114config . categories . forEach ( ( cat ) => {
1215 feed . addCategory ( cat ) ;
1316} ) ;
1417
1518const rssPlugin = ( routes ) => {
16- console . log ( 'Started @notiz/scully-plugin-rss' ) ;
19+ log ( 'Started @notiz/scully-plugin-rss' ) ;
20+
1721 const blogPosts = routes . filter (
1822 ( r ) =>
1923 r && r . data && r . data . published && r . route . includes ( blogPostRouteSlug )
@@ -29,8 +33,8 @@ const rssPlugin = (routes) => {
2933 } ) ;
3034 }
3135
32- console . log (
33- `Generating RSS Feed for ${ blogPosts . length } blog ${
36+ log (
37+ `Generating RSS Feed for ${ yellow ( blogPosts . length ) } published blog ${
3438 blogPosts . length === 1 ? 'post' : 'posts'
3539 } `
3640 ) ;
@@ -40,13 +44,13 @@ const rssPlugin = (routes) => {
4044 feed . addItem ( item ) ;
4145 } ) ;
4246 writeFileSync ( join ( config . outDir || '' , 'feed.xml' ) , feed . rss2 ( ) ) ;
43- console . log ( `✅ Created ${ join ( config . outDir || '' , ' feed.xml') } ` ) ;
47+ log ( `✅ Created ${ yellow ( config . outDir + '/ feed.xml') } ` ) ;
4448 writeFileSync ( join ( config . outDir || '' , 'feed.atom' ) , feed . atom1 ( ) ) ;
45- console . log ( `✅ Created ${ join ( config . outDir || '' , ' feed.atom') } ` ) ;
49+ log ( `✅ Created ${ yellow ( config . outDir + '/ feed.atom') } ` ) ;
4650 writeFileSync ( join ( config . outDir || '' , 'feed.json' ) , feed . json1 ( ) ) ;
47- console . log ( `✅ Created ${ join ( config . outDir || '' , ' feed.json ') } ` ) ;
51+ log ( `✅ Created ${ yellow ( config . outDir + '/ feed.atom ') } ` ) ;
4852
49- console . log ( 'Finished @notiz/scully-plugin-rss' ) ;
53+ log ( 'Finished @notiz/scully-plugin-rss' ) ;
5054} ;
5155
5256const createFeedItemFromRoute = ( route ) => {
0 commit comments