@@ -19,13 +19,13 @@ module.exports = {
19
19
q : `in:blog wip:false` ,
20
20
} ,
21
21
} ,
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
+ } ,
29
29
`gatsby-transformer-yaml` ,
30
30
`gatsby-plugin-emotion` ,
31
31
{
@@ -66,11 +66,9 @@ module.exports = {
66
66
feeds : [
67
67
{
68
68
serialize : ( {
69
- query : { site, allEsaPost } ,
70
- // query: { site, allEsaPost, allExternalPostsYaml },
69
+ query : { site, allEsaPost, allExternalPostsYaml } ,
71
70
} ) => {
72
- // return [...allEsaPost.edges, ...allExternalPostsYaml.edges]
73
- return [ ...allEsaPost . edges ]
71
+ return [ ...allEsaPost . edges , ...allExternalPostsYaml . edges ]
74
72
. sort ( ( a , b ) => {
75
73
const bDate = b . node . pubDate
76
74
? new Date ( b . node . pubDate )
@@ -96,20 +94,20 @@ module.exports = {
96
94
description : node . fields . excerpt ,
97
95
}
98
96
}
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
+ }
113
111
default : {
114
112
throw `${ node . internal . type } is unknown type`
115
113
}
@@ -136,6 +134,25 @@ module.exports = {
136
134
}
137
135
}
138
136
}
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
+ }
139
156
}
140
157
` ,
141
158
output : '/rss.xml' ,
0 commit comments