forked from NickUfer/web
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgatsby-config.js
343 lines (331 loc) · 11.4 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
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
const getTimeValueInSeconds = (timeValue) => {
if (Number(timeValue).toString() === timeValue) {
return timeValue
}
const {
2: hours = '0',
4: minutes = '0',
6: seconds = '0'
} = timeValue.match(/((\d*)h)?((\d*)m)?((\d*)s)?/)
return String((Number(hours) * 60 + Number(minutes)) * 60 + Number(seconds))
}
const getYoutubeID = (urlString) => {
const url = new URL(urlString)
return url.host === 'youtu.be' ? url.pathname.slice(1) : url.searchParams.get('v')
}
const getYouTubeIFrameSrc = (urlString) => {
const url = new URL(urlString)
const id = getYoutubeID(urlString)
const embedUrl = new URL(
`https://www.youtube-nocookie.com/embed/${id}?rel=0`
)
url.searchParams.forEach((value, name) => {
if (name === 'v') {
return
}
if (name === 't') {
embedUrl.searchParams.append('start', getTimeValueInSeconds(value))
} else {
embedUrl.searchParams.append(name, value)
}
})
return embedUrl.toString()
}
module.exports = {
siteMetadata: {
title: `ory.sh`,
description: `Implement OAuth 2.0 and OpenID Connect in minutes with open source from ORY. Works in both new and existing systems.`,
author: `ORY Corp.`,
siteUrl: `https://www.ory.sh`
},
plugins: [
`gatsby-plugin-typescript`,
{
resolve: `gatsby-source-filesystem`,
options: {
name: `images`,
path: `${__dirname}/src/images`
}
},
{
resolve: `gatsby-source-filesystem`,
options: {
name: `markdown`,
path: `${__dirname}/src/markdown/pages`
}
},
{
resolve: `gatsby-source-filesystem`,
options: {
name: `posts`,
path: `${__dirname}/src/markdown/blog`
}
},
{
resolve: `gatsby-source-filesystem`,
options: {
name: `summit`,
path: `${__dirname}/src/markdown/summit`
}
},
{
resolve: `gatsby-source-filesystem`,
options: {
name: `jobs`,
path: `${__dirname}/src/markdown/jobs`
}
},
`gatsby-plugin-image`,
`gatsby-plugin-sharp`,
`gatsby-transformer-sharp`,
{
resolve: 'gatsby-plugin-react-svg',
options: {
rule: {
include: /.*images\/animations\/.*\.svg$/ // See below to configure properly
}
}
},
{
resolve: `gatsby-plugin-mdx`,
options: {
extensions: [`.md`, `.mdx`],
remarkPlugins: [
[
require(`remark-admonitions`), {
tag: ':::',
icons: 'svg'
}
]
],
gatsbyRemarkPlugins: [
{
resolve: `gatsby-remark-images`,
options: {
// It's important to specify the maxWidth (in pixels) of
// the content container as this plugin uses this as the
// base for generating different widths of each image.
maxWidth: 860,
tracedSVG: true,
loading: 'lazy',
withWebp: true
}
},
{
resolve: `gatsby-remark-embedder`,
options: {
customTransformers: [
{
shouldTransform: (url) => {
const { host, pathname, searchParams } = new URL(url)
return (
host === 'youtu.be' ||
(['youtube.com', 'www.youtube.com'].includes(host) &&
pathname.includes('/watch') &&
Boolean(searchParams.get('v')))
)
},
getHTML: (url, { width = '100%', height = '315' }) => {
const iframeSrc = getYouTubeIFrameSrc(url)
const id = getYoutubeID(url)
return `<div class='youtube'><iframe loading='lazy' width='${width}' height='${height}' src='${iframeSrc}' frameBorder='0' allow='accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture' allowFullScreen srcdoc="<style>*{padding: 0; margin: 0; overflow: hidden}html, body{height: 100%}img, span{position: absolute; width: 100%; top: 0; bottom: 0; margin: auto}span{height: 1.5em; text-align: center; font: 48px/1.5 sans-serif; color: white; text-shadow: 0 0 0.5em black}</style><a href='${iframeSrc}&autoplay=1'><img src='https://img.youtube.com/vi/${id}/hqdefault.jpg'/><span>▶</span></a>"></iframe></div>`
},
name: 'YouTube'
}
]
}
},
{
resolve: 'gatsby-remark-emojis',
options: {
active: true,
class: 'remark-emoji',
size: 64
}
},
// prismjs to be loaded last or it will interfere with remark-embed-video
{
resolve: `gatsby-remark-prismjs`,
options: {
// Class prefix for <pre> tags containing syntax highlighting;
// defaults to 'language-' (eg <pre class="language-js">).
// If your site loads Prism into the browser at runtime,
// (eg for use with libraries like react-live),
// you may use this to prevent Prism from re-processing syntax.
// This is an uncommon use-case though;
// If you're unsure, it's best to use the default value.
classPrefix: 'language-'
}
},
{
resolve: `gatsby-remark-autolink-headers`
}
]
}
},
`gatsby-plugin-react-helmet`,
{
resolve: `gatsby-plugin-react-helmet-canonical-urls`,
options: {
siteUrl: `https://www.ory.sh`
}
},
{
resolve: `gatsby-plugin-postcss`,
options: {
cssLoaderOptions: {},
postCssPlugins: [
require('postcss-for'),
require('lost'),
require(`postcss-preset-env`)({
stage: 0,
features: {
'custom-media-queries': {
importFrom: [
{
customMedia: {
'--sm-viewport': '(max-width: 375px)',
'--md-viewport': '(max-width: 768px) and (min-width: 375px)',
'--lg-viewport': '(min-width: 769px)',
'--mobile-viewport': '(max-width: 768px)',
'--xs': '(min-width: 0px) and (max-width: 599px)', // small phone
'--sm': '(min-width: 600px) and (max-width: 959px)', // larger phone / tablet
'--md': '(min-width: 960px) and (max-width: 1279px)', // small laptop/desktop
'--lg': '(min-width: 1280px) and (max-width: 1919px)', // standard desktop
'--xl': '(min-width: 1920px)'
}
}
]
}
}
})
]
}
},
{
resolve: `gatsby-plugin-sitemap`,
options: {
output: `/sitemap`
}
},
// `gatsby-transformer-sharp`,
// `gatsby-plugin-sharp`,
// {
// 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/images/gatsby-icon.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
{
resolve: `gatsby-plugin-manifest`,
options: {
icon: 'src/images/icon/favicon-196x196.png',
name: `ORY Website and Documentation`,
short_name: `ORY`,
start_url: `/`,
background_color: `#15283B`,
theme_color: `#6274F3`,
display: `browser`
}
},
{
resolve: `gatsby-plugin-offline`,
options: {
workboxConfig: {
importWorkboxFrom: `cdn`,
runtimeCaching: [
{
// Do not cache ads
urlPattern: /^https?:\/\/codefund\.io/,
handler: `NetworkOnly`
},
{
// Cache docs css etc
urlPattern: /^.+\/docs\/.+\.(css|js|png|svg|jpg)/,
handler: `StaleWhileRevalidate`
},
{
// Cache docs pages
urlPattern: /^.+\/docs\/([a-zA-Z0-9\-_\/]+)(\/||\.html|\.htm)/,
handler: `NetworkFirst`
}
]
}
}
},
`gatsby-plugin-force-trailing-slashes`,
{
resolve: "gatsby-plugin-netlify-cms",
options: {
modulePath: `${__dirname}/src/cms/cms.js`,
},
},
{
resolve: 'gatsby-plugin-matomo',
options: {
siteId: '2',
cookieDomain: '*.ory.sh',
// disableCookies: true,
matomoUrl: 'https://sqa-web.ory.sh',
siteUrl: 'https://www.ory.sh',
matomoPhpScript: 'np.php',
matomoJsScript: 'js/np.min.js',
trackLoad: true,
enableJSErrorTracking: true,
disableCookies: true
}
},
// {
// resolve: `gatsby-plugin-gdpr-cookies`,
// options: {
//
// googleAnalytics: {
// trackingId: 'UA-71865250-1',
// cookieName: 'gdpr_cookie_analytics',
// anonymize: true,
// allowAdFeatures: false
// },
//
// googleTagManager: {
// trackingId: '',
// cookieName: 'gdpr_cookie_analytics'
// },
//
// facebookPixel: {
// pixelId: '', // leave empty if you want to disable the tracker
// cookieName: 'gdpr_cookie_analytics' // default
// },
//
// environments: ['production', 'development']
// }
// }
// make sure to keep it last in the array
{
resolve: "gatsby-plugin-netlify",
options: {
// It seems like there's an issue with the _headers file and the `X-Frame-Options` header.
// https://answers.netlify.com/t/x-frame-options-header-not-updated-cached-headers/29070
// The following lines is a workaround for this issue.
// https://answers.netlify.com/t/change-the-header-x-frame-options-to-one-of-my-environments/27974/9
headers: {
"/*": [
"X-Frame-Options: SAMEORIGIN",
"X-XSS-Protection: 1",
"Content-Security-Policy: default-src 'self' blob: 'unsafe-inline' 'unsafe-eval' unpkg.com miro.com *.algolianet.com *.algolianet.net storage.googleapis.com tagmanager.google.com *.googletagmanager.com *.google-analytics.com google-analytics.com ssl.gstatic.com gstatic.com fonts.gstatic.com github.com *.githubusercontent.com gh-card.dev *.ory.sh *.youtube.com *.youtube-nocookie.com fonts.googleapis.com fonts.gstatic.com data: s.ytimg.com *.iubenda.com *.cloudfront.net *.licdn.com *.hs-scripts.com *.hsleadflows.net *.hs-banner.com *.hsadspixel.net *.hubspotfeedback.com *.usemessages.com *.hs-analytics.net *.hscollectedforms.net *.hsforms.net *.hsforms.com *.g.doubleclick.net *.hubapi.com *.hubspot.com; img-src * data:",
"X-Content-Type-Options: nosniff",
"Referrer-Policy: strict-origin-when-cross-origin",
"Permissions-Policy: accelerometer=(), ambient-light-sensor=(), battery=(), camera=(), display-capture=(), geolocation=(), gyroscope=(), magnetometer=(), microphone=(), midi=(), usb=()",
],
},
},
},
]
}