forked from thechicagoreporter/govbook
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgatsby-config.js
213 lines (207 loc) · 5.51 KB
/
gatsby-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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
require('dotenv').config()
module.exports = {
siteMetadata: {
defaultLanguage: 'en',
},
plugins: [
`gatsby-plugin-react-helmet`,
`gatsby-plugin-sass`,
{
// Querying to a SQLite database
resolve: `gatsby-source-sql`,
options: {
typeName: 'Contacts',
// This is the field under which the data will be accessible in a future version
fieldName: 'dontunderstandthis',
dbEngine: {
client: 'sqlite3',
connection: {
filename: './data/processed/contacts.sqlite',
},
useNullAsDefault: true
},
queryChain: function(x) {
return x
.select(
"County",
"UnitName",
"Description",
"Code",
"Address",
"City",
"State",
"ZIP",
"FirstName",
"LastName",
"Title",
"Phone",
"Ext",
"Fax",
"Email_GOV",
"CEOFName",
"CEOLName",
"CEOTitle",
"CEOAddr",
"CEOCity",
"CEOState",
"CEOZIP",
"CEOPhone",
"CEOExt",
"CEOFax",
"CEOEmail",
"CFOFName",
"CFOLName",
"CFOTitle",
"CFOAddr",
"CFOCity",
"CFOState",
"CFOZIP",
"CFOPhone",
"CFOExt",
"CFOFax",
"CFOEmail",
"PAFName",
"PALName",
"PATitle",
"PAAddr",
"PACity",
"PAState",
"PAZIP",
"PAPhone",
"PAExt",
"PAFax",
"PAEmail",
"TIFFName",
"TIFLName",
"TIFTitle",
"TIFAddr",
"TIFCity",
"TIFState",
"TIFZIP",
"TIFPhone",
"TIFExt",
"TIFFax",
"TIFEmail",
"FOIAFName",
"FOIALName",
"FOIATitle",
"FOIAAddr",
"FOIACity",
"FOIAState",
"FOIAZIP",
"FOIAPhone",
"FOIAExt",
"FOIAFax",
"FOIAEmail",
)
.from("contacts")
.limit(20)
}
}
},
{
resolve: `gatsby-plugin-intl`,
options: {
// language JSON resource path
path: `${__dirname}/src/intl`,
// supported language
languages: [`en`, `es`],
// language file path
defaultLanguage: `en`,
redirect: true,
},
},
{
resolve: `gatsby-plugin-lunr`,
options: {
languages: [
{
name: 'en',
},
],
// Fields to index. If store === true value will be stored in index file.
// Attributes for custom indexing logic. See https://lunrjs.com/docs/lunr.Builder.html for details
fields: [
{ name: 'County', store: false, boost: 30 },
{ name: 'UnitName', store: false, boost: 10, },
{ name: 'ExecName', store: false, boost: 10 },
{ name: 'Description', store: false },
{ name: 'Code', store: true },
],
// How to resolve each field's value for a supported node type
resolvers: {
Contacts: {
County: node => node.County,
Description: node => node.Description,
UnitName: node => node.UnitName,
Code: node => node.Code,
ExecName: node => (`${node.CEOFName} ${node.CEOLName}`),
},
},
filterNodes: (node) => (node.fields.Address),
//custom index file name, default is search_index.json
filename: 'search_index.json',
//custom options on fetch api call for search_ındex.json
fetchOptions: {
credentials: 'same-origin'
},
},
},
// Markdown driven pages
{
resolve: `gatsby-source-filesystem`,
options: {
name: `markdown`,
path: `${__dirname}/src/pages/markdown`,
},
},
{
resolve: `gatsby-plugin-google-gtag`,
options: {
trackingIds: [
"", // Google Analytics / GA
],
gtagConfig: {
anonymize_ip: true,
send_pageview: false,
},
pluginConfig: {
// We'll dispatch our own prefixed pageviews
exclude: ["/*"],
},
},
},
{
resolve: `gatsby-plugin-prefetch-google-fonts`,
options: {
fonts: [
{
family: `Open Sans`,
subsets: [`latin`],
variants: [`400`, `400i`, `600`, `700`],
},
{
family: `Open Sans Condensed`,
subsets: [`latin`],
variants: [`300l`, `300i`, `700`],
},
],
},
},
{
resolve: `gatsby-plugin-manifest`,
options: {
name: `GovBook`,
short_name: `GovBook`,
start_url: `/`,
background_color: `#000000`,
theme_color: `#ffffff`,
display: `minimal-ui`,
icon: `src/images/favicon.png`, // This path is relative to the root of the site.
},
},
// this (optional) plugin enables Progressive Web App + Offline functionality
// To learn more, visit: https://gatsby.dev/offline
`gatsby-plugin-offline`,
],
}