forked from prisma/docs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gatsby-config.js
166 lines (162 loc) Β· 4.77 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
const path = require('path')
const config = require('./config')
require('dotenv').config()
const gatsbyRemarkPlugins = [
'gatsby-remark-sectionize',
'gatsby-remark-normalize-paths',
{
resolve: `gatsby-remark-autolink-headers`,
options: {
icon: `<svg width="17" height="18" viewBox="0 0 17 18" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M1.5 6.33337H15.5" stroke="#CBD5E0" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"/>
<path d="M1.5 11.6666H15.5" stroke="#CBD5E0" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"/>
<path d="M6.75 1L5 17" stroke="#CBD5E0" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"/>
<path d="M12 1L10.25 17" stroke="#CBD5E0" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"/>
</svg>`,
className: `title-link`,
enableCustomId: true,
},
},
{
resolve: `gatsby-remark-images`,
options: {
disableBgImageOnAlpha: true,
},
},
{
resolve: require.resolve('./plugins/gatsby-remark-to-absoluteurl'),
options: {
redirects: config.redirects,
},
},
{
resolve: require.resolve('./plugins/gatsby-remark-check-links-numberless'),
options: {
// Do not surface links to these pages as broken:
exceptions: [
'/getting-started/setup-prisma/add-to-existing-project/relational-databases-typescript-postgres',
'/getting-started/setup-prisma/start-from-scratch/relational-databases-typescript-postgres',
'/guides/upgrade-guides/upgrade-from-prisma-1/schema-incompatibilities-postgres',
'/guides/upgrade-guides/upgrade-from-prisma-1/upgrading-the-prisma-layer-postgres',
],
},
},
{
resolve: 'gatsby-remark-copy-linked-files',
options: {
destinationDir: 'static',
},
},
]
const algoliaPlugin = {
resolve: `gatsby-plugin-algolia`,
options: require(`./src/utils/algolia`),
}
let plugins = [
'gatsby-plugin-react-helmet',
'gatsby-transformer-sharp',
'gatsby-plugin-sharp',
'gatsby-plugin-typescript',
'gatsby-image',
'gatsby-plugin-styled-components',
'gatsby-plugin-smoothscroll',
'gatsby-plugin-catch-links',
// {
// resolve: `gatsby-plugin-layout`,
// options: {
// component: require.resolve(`./src/layouts/articleLayout.tsx`),
// },
// },
{
resolve: `gatsby-plugin-sitemap`,
options: {
sitemapSize: 5000,
exclude: [
// Remove these from sitemap for SEO purposes as they're redirected
`/getting-started/quickstart`,
`/getting-started/setup-prisma/add-to-existing-project`,
`/getting-started/setup-prisma/start-from-scratch-prisma-migrate`,
`/getting-started/setup-prisma/start-from-scratch-sql`,
],
},
},
{
resolve: 'gatsby-plugin-robots-txt',
options: {
policy: [
{
userAgent: '*',
disallow: '/',
},
],
},
},
// 'gatsby-plugin-offline', // it causes infinite loop issue with workbox
{
resolve: `gatsby-plugin-mdx`,
options: {
defaultLayouts: {
default: require.resolve('./src/layouts/articleLayout.tsx'),
},
extensions: ['.mdx', '.md'],
gatsbyRemarkPlugins,
},
},
{
resolve: 'gatsby-source-filesystem',
options: {
name: 'docs',
path: `${__dirname}/content`,
ignore: ['**/.tsx*'],
},
},
{
resolve: 'gatsby-source-filesystem',
options: {
name: 'images',
path: `${__dirname}/src/images`,
},
},
'gatsby-plugin-remove-trailing-slashes',
'gatsby-plugin-meta-redirect',
'gatsby-plugin-page-list',
{
resolve: 'gatsby-plugin-google-tagmanager',
options: {
id: 'GTM-KCGZPWB',
includeInDevelopment: false,
defaultDataLayer: { website: 'docs' },
},
},
{
resolve: `gatsby-plugin-percy`,
options: {
// see actual configuration in `percy` key in `package.json`
},
},
]
if (process.env.INDEX_ALGOLIA === 'true') {
plugins = [...plugins, algoliaPlugin]
}
module.exports = {
// The line below has been disabled so that both PR previews and production use the same paths
// pathPrefix: process.env.ADD_PREFIX === 'true' ? config.gatsby.pathPrefix : '/',
pathPrefix: config.gatsby.pathPrefix,
siteMetadata: {
pathPrefix: config.gatsby.pathPrefix,
title: config.siteMetadata.title,
titlePrefix: config.gatsby.titlePrefix,
titleSuffix: config.gatsby.titleSuffix,
description: config.siteMetadata.description,
keywords: config.siteMetadata.keywords,
twitter: config.siteMetadata.twitter,
og: config.siteMetadata.og,
header: config.header,
siteUrl: config.gatsby.siteUrl,
footer: config.footer,
docsLocation: config.siteMetadata.docsLocation,
redirects: config.redirects,
homepage: config.homepage,
},
plugins,
}