-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgatsby-config.js
195 lines (188 loc) · 5.22 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
const path = require('path');
require('dotenv').config();
// Support for Gatsby CLI
let siteUrl = 'http://localhost:8000';
// Support for Production site builds.
if (process.env.CONTEXT === 'production') {
siteUrl = process.env.URL;
}
// Support for non-production netlify builds (branch/preview)
else if (process.env.CONTEXT !== 'production' && process.env.NETLIFY) {
siteUrl = process.env.DEPLOY_PRIME_URL;
}
// Support for Netlify CLI.
else if (process.env.NETLIFY_DEV === true) {
siteUrl = 'http://localhost:64946';
}
/**
* Resolve relations for storyblok.
*/
const storyblokRelations = [
'oodQuoteSlider.quotes',
'globalFooterPicker.globalFooter',
'localFooterPicker.localFooter',
'localHeaderPicker.localHeader',
'contentMenuPicker.contentMenu',
'storyPicker.story',
'alertPicker.alert',
'endowedPositionsSearchPicker.endowedPositionsSearch',
'countdownPicker.countdown',
];
module.exports = {
siteMetadata: {
title: `Giving to Stanford`,
description: `Giving to Stanford.`,
author: `Stanford University Office of Development`,
siteUrl,
// This key is for metadata only and can be statically queried
storyblok: {
resolveRelations: storyblokRelations,
},
},
plugins: [
{
resolve: `gatsby-plugin-postcss`,
},
`gatsby-plugin-react-helmet`,
`gatsby-plugin-sharp`,
`gatsby-transformer-sharp`,
{
resolve: 'gatsby-plugin-robots-txt',
options: {
policy: [
{ userAgent: '*', allow: '/' },
{ userAgent: '*', disallow: '/editor/' },
],
},
},
{
resolve: 'gatsby-plugin-google-tagmanager',
options: {
id: 'GTM-5RGQ5DD',
// Include GTM in development.
//
// Defaults to false meaning GTM will only be loaded in production.
includeInDevelopment: false,
// datalayer to be set before GTM is loaded
// should be an object or a function that is executed in the browser
//
// Defaults to null
defaultDataLayer: { platform: 'gatsby' },
},
},
{
resolve: `gatsby-plugin-sitemap`,
options: {
query: `
{
site {
siteMetadata {
siteUrl
}
}
allSitePage {
edges {
node {
path
pageContext
}
}
}
}
`,
resolvePages: ({ allSitePage: { edges: allPages } }) => {
return allPages.map((page) => {
return { ...page.node };
});
},
resolveSiteUrl: () => siteUrl,
excludes: [
'/editor',
'/editor/**',
'/global-components/**',
'/test-items/**',
'/403',
],
// eslint-disable-next-line consistent-return
filterPages: (page, excludedRoute, tools) => {
// Return true excludes the path, false keeps it.
if (
// Exclude non-canonical pages.
!page.pageContext.isCanonical ||
// Exclude pages marked with "noindex"
page.pageContext.noindex ||
// Exclude pages that match the "excludes" array. (default condition)
tools.minimatch(
tools.withoutTrailingSlash(tools.resolvePagePath(page)),
tools.withoutTrailingSlash(excludedRoute)
)
) {
return true;
}
},
},
},
{
resolve: 'gatsby-source-storyblok',
options: {
accessToken: process.env.GATSBY_STORYBLOK_ACCESS_TOKEN,
homeSlug: 'home',
resolveRelations: storyblokRelations,
resolveLinks: 'url',
version: process.env.NODE_ENV == 'production' ? 'published' : 'draft', // show only published on the front end site
// version: 'draft' // would show any including drafts
},
},
{
resolve: `gatsby-plugin-sass`,
options: {
sassOptions: {
includePaths: [path.resolve(__dirname, 'node_modules')],
},
cssLoaderOptions: {
camelCase: false,
},
},
},
{
resolve: `gatsby-plugin-manifest`,
options: {
name: `Giving to Stanford`,
start_url: `/`,
include_favicon: false,
crossOrigin: `use-credentials`,
icons: [],
},
},
// this (optional) plugin enables Progressive Web App + Offline functionality
// To learn more, visit: https://gatsby.dev/offline
// `gatsby-plugin-offline`,
{
resolve: `gatsby-plugin-algolia`,
options: {
appId: process.env.GATSBY_ALGOLIA_APP_ID,
apiKey: process.env.ALGOLIA_ADMIN_KEY,
// enablePartialUpdates: true,
queries: require('./src/utilities/algoliaQueries'),
// we skip the indexing completely on non-prod builds.
skipIndexing: !!(
process.env.ALGOLIA_SKIP_INDEXING === 'true' ||
process.env.CONTEXT !== 'production'
),
},
},
{
resolve: `gatsby-plugin-netlify`,
options: {
mergeSecurityHeaders: false,
},
},
`gatsby-transformer-json`,
{
resolve: `gatsby-source-filesystem`,
options: {
path: `./src/constants/`,
},
},
],
};