-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgatsby-config.js
executable file
·218 lines (210 loc) · 6.48 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
214
215
216
217
218
require("dotenv").config({
path: `.env.${process.env.NODE_ENV}`
})
module.exports = {
siteMetadata: {
title: `${process.env.GATSBY_TITLE}`,
description: `${process.env.GATSBY_DESCRIPTION}`,
author: `@Teelac`,
authorUrl: "https://every-tuesday.com/about/#teela",
siteUrl: `${process.env.GATSBY_FRONTEND_URL}`,
frontEndUrl: `${process.env.GATSBY_FRONTEND_URL}`,
siteName: `Every-Tuesday Shop`
},
plugins: [
// `gatsby-source-test`,
`gatsby-source-etshop`,
`gatsby-plugin-typescript`,
{
resolve: `gatsby-plugin-stripe`,
options: {
async: true
}
},
{
resolve: `gatsby-plugin-styled-components`,
options: {
// Add any options here
displayName: true
}
},
{
resolve: "gatsby-plugin-module-resolver",
options: {
root: "./src", // <- will be used as a root dir
aliases: {
"@api": "./api",
"@components": "./components", // <- will become ./src/components
"@et/types": "./types",
"@redux": "./state",
"@svg": "./assets/svg",
"@styles": "./styles",
"@utils": "./utils",
// helpers: './helpers', // <- will become ./src/helpers
static: {
root: "./public", // <- will used as this alias' root dir
alias: "./static" // <- will become ./public/static
}
}
}
},
{
resolve: `gatsby-source-filesystem`,
options: {
name: `images`,
path: `${__dirname}/src/assets/images`
}
},
{
resolve: `gatsby-plugin-manifest`,
options: {
name: `gatsby-starter-default`,
short_name: `starter`,
start_url: `/`,
background_color: `#663399`,
theme_color: `#663399`,
display: `minimal-ui`,
icon: `src/assets/images/gatsby-icon.png` // This path is relative to the root of the site.
}
},
{
resolve: `gatsby-plugin-prefetch-google-fonts`,
options: {
fonts: [
{
family: `Fira Sans`,
subsets: [`latin`],
variants: [`400`, `500`, `600`, `700`]
}
],
formats: [
"woff",
"woff2"
]
}
},
{
resolve: "gatsby-plugin-react-svg",
options: {
rule: {
include: /svg-icons/
}
}
},
`gatsby-plugin-react-helmet`,
`gatsby-transformer-sharp`,
`gatsby-plugin-sharp`,
`gatsby-plugin-playground`,
{
resolve: `gatsby-source-graphql`,
options: {
// This type will contain remote schema Query type
typeName: `WPGraphQL`,
// This is field under which it's accessible
fieldName: `wpgraphql`,
// Url to query from
url: `${process.env.GATSBY_DB}/graphql`
}
},
{
resolve: "gatsby-wpgraphql-inline-images",
options: {
wordPressUrl: `${process.env.GATSBY_DB}`,
uploadsUrl: `${process.env.GATSBY_DB}/wp-content/uploads/`,
processPostTypes: ["Page", "Post", "SupportQuestion"],
graphqlTypeName: "WPGraphQL"
}
},
// this (optional) plugin enables Progressive Web App + Offline functionality
// To learn more, visit: https://gatsby.app/offline
"gatsby-plugin-offline",
{
resolve: "gatsby-plugin-robots-txt",
options: {
host: process.env.GATSBY_DB,
sitemap: `${process.env.GATSBY_DB}/sitemap.xml`
// policy: [{ userAgent: '*', allow: '/' }]
}
},
{
resolve: `gatsby-plugin-sitemap`,
options: {
serialize: ({ site, allSitePage }) => {
return allSitePage.edges
.sort((a, b) => {
// Default to 0, which indicates
// no sorting is necessary
let returnVal = 0
// If `a` is a Chevy, subtract 1
// to move `a` "up" in the sort order
// because Chevys are awesome.
if (a.node.path === "/") {
returnVal = returnVal - 1
}
if (b.node.path === "/") {
returnVal = returnVal + 1
}
// If `b` is a Chevy, add 1
// to move `b` "up" in the sort order
// if (b.match(/Chevy/)) {
// returnVal = returnVal + 1;
// }
return returnVal
})
.map(edge => {
const urlPath = edge.node.path
// console.log('urlPath', urlPath)
const productsRegex = /(\/products\/)/
if (urlPath === "/") {
return {
url: site.siteMetadata.siteUrl + edge.node.path,
changefreq: `daily`,
priority: 1
}
} else if (urlPath.match(productsRegex)) {
return {
url: site.siteMetadata.siteUrl + edge.node.path,
changefreq: `weekly`,
priority: 0.7
}
} else {
return {
url: site.siteMetadata.siteUrl + edge.node.path,
changefreq: `monthly`,
priority: 0.5
}
}
})
}
}
},
// // make sure to put last in the array
{
resolve: `gatsby-plugin-netlify`,
options: {
headers: {
"/*": [
`Referrer-Policy: no-referrer-when-downgrade`,
`Access-Control-Allow-Origin: *`,
`Expect-CT: enforce,max-age=604800`
]
}, // option to add more headers. `Link` headers are transformed by the below criteria
allPageHeaders: [
// "Link: </static/fonts/Sentinel-Black.woff2>; rel=preload; as=font"
// `Link: </icons/icon-48x48.png>; rel=preload; as=image`
],// option to add headers for all pages. `Link` headers are transformed by the below criteria
mergeSecurityHeaders: true,// boolean to turn off the default security headers
mergeLinkHeaders: false,// boolean to turn off the default gatsby js headers (disabled by default, until gzip is fixed for server push)
mergeCachingHeaders: true// boolean to turn off the default caching headers
// transformHeaders: (headers, path) => headers, // optional transform for manipulating headers under each path (e.g.sorting), etc.
}
},
{
resolve: `gatsby-plugin-hotjar`,
options: {
id: 1676936,
sv: 6
}
}
]
}