Skip to content

Commit 2c689cd

Browse files
committed
fix(plugin): fixed rss plugin
use dayjs to convert strings to dates, or date objects to dates, for the rss plugin added dayjs as a dependency for the plugin added myself as a contributor to the plugin
1 parent dde6026 commit 2c689cd

8 files changed

Lines changed: 48 additions & 11 deletions

File tree

content/blog/2020-03-19-news.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
---
22
title: News
33
description: 'News description'
4-
publishedAt: 2020-03-25T10:12:00.000Z
5-
updatedAt: 2020-03-25T10:12:00.000Z
4+
publishedAt: '2020-03-25T10:12:00.000Z'
5+
updatedAt: '2020-03-25T10:12:00.000Z'
66
published: false
77
tags:
88
- fouc

content/blog/2020-03-20-blog.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
---
22
title: Blog
33
description: blog description
4-
publishedAt: 2020-03-25T10:12:00.000Z
5-
updatedAt: 2020-03-25T10:12:00.000Z
4+
publishedAt: '2020-03-25T10:12:00.000Z'
5+
updatedAt: '2020-03-25T10:12:00.000Z'
66
published: true
77
tags: [rss]
88
authors:

content/blog/2020-03-21-food.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
---
22
title: Food
33
description: Food description
4-
publishedAt: 2020-03-25T10:12:00.000Z
5-
updatedAt: 2020-03-25T10:12:00.000Z
4+
publishedAt: '2020-03-25T10:12:00.000Z'
5+
updatedAt: '2020-03-25T10:12:00.000Z'
66
published: true
77
tags: [lazy-images]
88
authors:

package-lock.json

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
"@scullyio/init": "1.0.0-beta.0",
3030
"@scullyio/ng-lib": "1.0.0-beta.0",
3131
"@scullyio/scully": "1.0.0-beta.0",
32+
"dayjs": "^1.9.6",
3233
"rxjs": "6.6.0",
3334
"tslib": "2.0.0",
3435
"zone.js": "0.10.3"

plugins/rss/package.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@
1212
{
1313
"name": "Marc Stammerjohann",
1414
"url": "https://notiz.dev/authors/marc-stammerjohann"
15+
},
16+
{
17+
"name": "Preston Lamb",
18+
"url": "https://www.prestonlamb.com"
1519
}
1620
],
1721
"repository": {
@@ -33,6 +37,7 @@
3337
},
3438
"dependencies": {
3539
"feed": "^4.1.0",
36-
"showdown": "^1.9.1"
40+
"showdown": "^1.9.1",
41+
"dayjs": "^1.9.6"
3742
}
3843
}

plugins/rss/src/rss.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
const dayjs = require('dayjs');
12
const Feed = require('feed').Feed;
23
const showdown = require('showdown');
34
const { writeFileSync, readFileSync } = require('fs');
@@ -27,8 +28,6 @@ const rssPlugin = (routes) => {
2728
});
2829
}
2930

30-
blogPosts.forEach((b) => console.log(b));
31-
3231
blogPosts.forEach((r) => {
3332
const item = createFeedItemFromRoute(r);
3433
feed.addItem(item);
@@ -64,7 +63,9 @@ const createFeedItemFromRoute = (route) => {
6463
name: a.toLowerCase().replace(' ', '-'),
6564
}))
6665
: [],
67-
date: route.data.updatedAt || route.data.publishedAt,
66+
date: route.data.updatedAt
67+
? dayjs(route.data.updatedAt).toDate()
68+
: dayjs(route.data.publishedAt).toDate(),
6869
image: route.data.twitterBanner,
6970
};
7071
}

scully.log

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,29 @@ Using stored unhandled routes!.
2424
----------------------------------
2525
Using stored unhandled routes!.
2626
To discover new routes in the angular app use "npm run scully -- --scanRoutes"
27-
----------------------------------
27+
----------------------------------
28+
----------------------------------
29+
Using stored unhandled routes!.
30+
To discover new routes in the angular app use "npm run scully -- --scanRoutes"
31+
----------------------------------
32+
----------------------------------
33+
Using stored unhandled routes!.
34+
To discover new routes in the angular app use "npm run scully -- --scanRoutes"
35+
----------------------------------
36+
----------------------------------
37+
Using stored unhandled routes!.
38+
To discover new routes in the angular app use "npm run scully -- --scanRoutes"
39+
----------------------------------Content file "./content/docs/medium-zoom.md" has no content!Content file "./content/docs/rss.md" has no content!
40+
41+
42+
Content file "./content/docs/medium-zoom.md" has no content!Content file "./content/docs/rss.md" has no content!
43+
44+
45+
----------------------------------
46+
Using stored unhandled routes!.
47+
To discover new routes in the angular app use "npm run scully -- --scanRoutes"
48+
----------------------------------Content file "./content/docs/medium-zoom.md" has no content!Content file "./content/docs/rss.md" has no content!
49+
50+
51+
Content file "./content/docs/medium-zoom.md" has no content!Content file "./content/docs/rss.md" has no content!
52+

0 commit comments

Comments
 (0)