-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpodcast-feed.js
More file actions
113 lines (109 loc) · 3 KB
/
podcast-feed.js
File metadata and controls
113 lines (109 loc) · 3 KB
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
const format = require('date-fns/format')
module.exports = {
resolve: 'gatsby-plugin-feed',
options: {
query: `
{
site {
id
}
}
`,
setup: options => ({
...options,
custom_namespaces: {
itunes: 'http://www.itunes.com/dtds/podcast-1.0.dtd'
},
custom_elements: [
{ language: 'en-us' },
{
'itunes:image': {
_attr: { href: 'https://midwaycc.org/logos/square-logo-large.png' }
}
},
{ 'itunes:author': 'Midway Community Church' },
{
'itunes:owner': [
{ 'itunes:name': 'Kevin Smith' },
{ 'itunes:email': '[email protected]' }
]
},
{
'itunes:category': [
{
_attr: {
text: 'Religion & Spirituality'
}
},
{
'itunes:category': {
_attr: {
text: 'Christianity'
}
}
}
]
},
{ 'itunes:subtitle': 'Helping people follow Jesus.' },
{
'itunes:summary':
'The weekly sermons preached by Pastor Dean Ropp of Midway Community Church in Alpharetta, GA'
},
{ 'itunes:explicit': 'clean' }
]
}),
feeds: [
{
output: '/rss.xml',
title: 'Midway Community Church Sermons',
description:
'The weekly sermons preached by Pastor Dean Ropp of Midway Community Church in Alpharetta, GA',
site_url: 'https://midwaycc.org',
feed_url: 'https://midwaycc.org/rss.xml',
query: `
{
allSanitySermonUpload(sort: {order: DESC, fields: date}) {
nodes {
audioFile {
asset {
url
size
mimeType
}
}
date
extraInfo
id
}
}
}
`,
serialize: ({ query }) => {
return query.allSanitySermonUpload.nodes
.map(node => {
if (!node.date || !node.audioFile || !node.audioFile.asset) {
return null
}
const date = new Date(node.date)
const pubDate = format(date, 'ccc, d LLL yyyy') + ' 18:00:00 GMT'
const title = [format(date, 'MMMM do, yyyy'), node.extraInfo]
.filter(Boolean)
.join(' - ')
const { url, size, mimeType } = node.audioFile.asset
if (!url || !size || !mimeType) {
return null
}
return {
guid: node.id,
title,
url: 'https://midwaycc.org/sermons',
enclosure: { url, size, type: mimeType },
custom_elements: [{ pubDate }]
}
})
.filter(Boolean)
}
}
]
}
}