-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathgridsome.config.js
149 lines (143 loc) · 3.73 KB
/
gridsome.config.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
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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
const path = require('path')
function addStyleResource(rule) {
rule
.use('style-resource')
.loader('style-resources-loader')
.options({
patterns: [
path.resolve(__dirname, './src/styles/_packages.scss'),
path.resolve(__dirname, './src/styles/_variables.scss'),
path.resolve(__dirname, './src/styles/_mixins.scss'),
],
})
}
const AlgoliaCollection = [
{
query: `{
vidoes: allPrismicVideo(sortBy: "data.publication_date", order: DESC) {
edges {
node {
uid
tags
slug
last_publication_date
data {
publication_date
title
image {
url
}
}
}
}
}
}`,
transformer: ({ data }) => data.vidoes.edges.map(({ node }) => node),
indexName: process.env.ALGOLIA_INDEX_NAME,
matchFields: ['slug', 'modified'],
itemFormatter: (item) => {
return {
objectID: item.uid,
title: item.data.title,
image: item.data.image.url,
tags: item.tags,
slug: item.slug,
publication_date: item.data.publication_date,
modified: item.last_publication_date,
}
},
},
]
module.exports = {
siteName: 'Tim Benniks',
siteUrl: 'https://timbenniks.nl',
icon: './src/favicon.png',
templates: {
PrismicVideo: [
{
path: '/videos/:id',
component: './src/templates/video.vue',
},
],
PrismicWriting: [
{
path: '/writings/:id',
component: './src/templates/writing.vue',
},
],
},
plugins: [
{
use: '@timbenniks/gridsome-source-prismic',
options: {
prismic_url: 'https://timbenniks.prismic.io/api/v2',
prismic_token: process.env.PRISMIC_TOKEN,
collection_prefix: 'Prismic',
link_resolver: require('./src/prismic/linkResolver'),
html_serializer: require('./src/prismic/htmlSerializer'),
},
},
{
use: '@gridsome/plugin-google-analytics',
options: {
id: 'UA-6797812-3',
},
},
{
use: '@gridsome/plugin-sitemap',
options: {
exclude: ['/startpage'],
},
},
{
use: 'gridsome-plugin-pwa',
options: {
title: 'Tim Benniks',
disableServiceWorker: false,
shortName: 'timbenniks.nl',
themeColor: '#3590d5',
backgroundColor: '#3590d5',
icon: './src/favicon.png',
msTileColor: '#3590d5',
},
},
{
use: 'gridsome-plugin-purgecss',
},
{
use: 'gridsome-plugin-feed',
options: {
contentTypes: ['PrismicWriting'],
feedOptions: {
title: 'Tim Benniks',
description:
'This is the personal website of Tim Benniks. This is the place where you can find my public speaking schedule and where I share my opinions! Check out my videos and blog posts.',
},
nodeToFeedItem: (node) => ({
title: node.data.title,
date: new Date(node.data.publication_date),
content: node.data.social_cards[0].content.description,
}),
},
},
{
use: 'gridsome-plugin-algolia',
options: {
appId: process.env.GRIDSOME_ALGOLIA_APP_ID,
apiKey: process.env.GRIDSOME_ALGOLIA_ADMIN_KEY,
collections: AlgoliaCollection,
chunkSize: 10000,
enablePartialUpdates: true,
},
},
],
chainWebpack(config) {
const types = ['vue-modules', 'vue', 'normal-modules', 'normal']
types.forEach((type) => {
addStyleResource(config.module.rule('sass').oneOf(type))
})
types.forEach((type) => {
addStyleResource(config.module.rule('scss').oneOf(type))
})
},
}