Skip to content

Commit 6322d75

Browse files
committed
Update gatsby-config.js.
1 parent 02d6282 commit 6322d75

File tree

2 files changed

+47
-30
lines changed

2 files changed

+47
-30
lines changed

data/external-posts.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
# - title: ネクイノ開発者ブログ:整理したい私はITILをかぶる、PlantUMLへの愛
2-
# link: https://nextinnovation-tec.hatenablog.com/entry/plantuml-to-itil
3-
# excerpt: 入社後8ヶ月、年の瀬ということで振り返り記事を書くことにしました。テーマはPlantUMLです
4-
# pubDate: 2020.12.30 11:30
5-
# category: blog/organization
1+
- title: nabinnoのブックマーク
2+
link: https://b.hatena.ne.jp/nabinno/
3+
excerpt: ソーシャルブックマークDeliciousの機能が制限された都合により、同一サービスのはてブに引っ越ししました。それから10年以上の付き合いになります
4+
pubDate: 2009.05.06 00:00
5+
category: blog/market

gatsby-config.js

Lines changed: 42 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@ module.exports = {
1919
q: `in:blog wip:false`,
2020
},
2121
},
22-
// {
23-
// resolve: `gatsby-source-filesystem`,
24-
// options: {
25-
// name: `posts`,
26-
// path: `${__dirname}/data/external-posts.yml`,
27-
// },
28-
// },
22+
{
23+
resolve: `gatsby-source-filesystem`,
24+
options: {
25+
name: `posts`,
26+
path: `${__dirname}/data/external-posts.yml`,
27+
},
28+
},
2929
`gatsby-transformer-yaml`,
3030
`gatsby-plugin-emotion`,
3131
{
@@ -66,11 +66,9 @@ module.exports = {
6666
feeds: [
6767
{
6868
serialize: ({
69-
query: { site, allEsaPost },
70-
// query: { site, allEsaPost, allExternalPostsYaml },
69+
query: { site, allEsaPost, allExternalPostsYaml },
7170
}) => {
72-
// return [...allEsaPost.edges, ...allExternalPostsYaml.edges]
73-
return [...allEsaPost.edges]
71+
return [...allEsaPost.edges, ...allExternalPostsYaml.edges]
7472
.sort((a, b) => {
7573
const bDate = b.node.pubDate
7674
? new Date(b.node.pubDate)
@@ -96,20 +94,20 @@ module.exports = {
9694
description: node.fields.excerpt,
9795
}
9896
}
99-
// case 'ExternalPostsYaml': {
100-
// return {
101-
// date: dayjs(
102-
// node.childPublishedDate.published_on,
103-
// ).toISOString(),
104-
// pubDate: dayjs(
105-
// node.childPublishedDate.published_on,
106-
// ).toISOString(),
107-
// url: node.link,
108-
// guid: node.link,
109-
// title: node.fields.title,
110-
// description: node.fields.excerpt.substring(0, 512),
111-
// }
112-
// }
97+
case 'ExternalPostsYaml': {
98+
return {
99+
date: dayjs(
100+
node.childPublishedDate.published_on,
101+
).toISOString(),
102+
pubDate: dayjs(
103+
node.childPublishedDate.published_on,
104+
).toISOString(),
105+
url: node.link,
106+
guid: node.link,
107+
title: node.fields.title,
108+
description: node.fields.excerpt.substring(0, 512),
109+
}
110+
}
113111
default: {
114112
throw `${node.internal.type} is unknown type`
115113
}
@@ -136,6 +134,25 @@ module.exports = {
136134
}
137135
}
138136
}
137+
allExternalPostsYaml {
138+
edges {
139+
node {
140+
link
141+
fields {
142+
title
143+
excerpt
144+
category
145+
}
146+
childPublishedDate {
147+
published_on
148+
published_on_unix
149+
}
150+
internal {
151+
type
152+
}
153+
}
154+
}
155+
}
139156
}
140157
`,
141158
output: '/rss.xml',

0 commit comments

Comments
 (0)