-
Notifications
You must be signed in to change notification settings - Fork 0
/
gatsby-config.plugins.feed.js
51 lines (50 loc) · 1.35 KB
/
gatsby-config.plugins.feed.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
const config = require('./config');
const utils = require('./src/utils');
module.exports = {
resolve: `gatsby-plugin-feed`,
options: {
feeds: [
{
serialize: ({ query: { allMarkdownRemark } }) => {
return allMarkdownRemark.edges.map(({ node }) => {
const { siteUrl, pathPrefix, author } = config
const { title, date, path, excerpt } = node.frontmatter
return Object.assign({}, node.frontmatter, {
title: title,
description: excerpt,
url: utils.resolveUrl(siteUrl, pathPrefix, path),
guid: siteUrl + path + title,
date: date,
author: author,
custom_elements: [
{ "content:encoded": node.html }
],
})
})
},
query: `
{
allMarkdownRemark(
limit: 10,
sort: { order: DESC, fields: [frontmatter___date] }
) {
edges {
node {
html
frontmatter {
title
date
path
excerpt
}
}
}
}
}
`,
output: "/rss.xml",
title: "Jerson Alexander RSS Feed",
},
],
},
}