forked from pantheon-systems/documentation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gatsby-config.js
244 lines (242 loc) · 9.04 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
const dotenv = require("dotenv")
// load environment specific configurations.
dotenv.config({
path: `.env.${process.env.NODE_ENV}`,
})
require("dotenv").config({
path: `.env.${process.env.NODE_ENV}`,
})
// Gatsby Configuration, Options, and Plugins
module.exports = {
// Puts build artifacts in a subdirectory, and updates all local links
pathPrefix: `/`,
// Reusable global information
siteMetadata: {
title: `Pantheon Docs`,
description: `Information for building, launching, and running dynamic sites on the Pantheon Website Management Platform`,
siteUrl: `https://docs.pantheon.io/`,
social: {
twitter: `getpantheon`,
},
},
// Creates a shorthand for Contributor data in GraphQL
mapping: {
"Mdx.frontmatter.contributors": "ContributorYaml",
},
plugins: [
`gatsby-transformer-yaml`,
`gatsby-plugin-image`,
{
// Handles inserting the GTM js blob into the site
resolve: `gatsby-plugin-google-tagmanager`,
options: {
id: "GTM-MDF545G", // process.env.GTM_ID_NEW,
//testing includeInDevelopment: false,
defaultDataLayer: {},
},
},
{
// Handles inserting the Segment js blob into the site
resolve: "gatsby-plugin-segment-js",
options: {
prodKey: "lEIpoQHx3G5Jqsy3GmjcPS357D4AlwlA",
devKey: "kDdX1dpmsAWuUn8zb1QDJR8YGbWJjKoj",
trackPage: false,
trackPageOnlyIfReady: true,
customSnippet:
'!function(){var analytics=window.analytics=window.analytics||[];if(!analytics.initialize)if(analytics.invoked)window.console&&console.error&&console.error("Segment snippet included twice.");else{analytics.invoked=!0;analytics.methods=["trackSubmit","trackClick","trackLink","trackForm","pageview","identify","reset","group","track","ready","alias","debug","page","once","off","on","addSourceMiddleware","addIntegrationMiddleware","setAnonymousId","addDestinationMiddleware"];analytics.factory=function(e){return function(){var t=Array.prototype.slice.call(arguments);t.unshift(e);analytics.push(t);return analytics}};for(var e=0;e<analytics.methods.length;e++){var key=analytics.methods[e];analytics[key]=analytics.factory(key)}analytics.load=function(key,e){var t=document.createElement("script");t.type="text/javascript";t.async=!0;t.src="https://cdn.segment.com/analytics.js/v1/" + key + "/analytics.min.js";var n=document.getElementsByTagName("script")[0];n.parentNode.insertBefore(t,n);analytics._loadOptions=e};analytics._writeKey="${writeKey}";;analytics.SNIPPET_VERSION="4.15.3";analytics.load("${writeKey}");analytics.ready(function() {window.dataLayer.push({"event": "segment_analytics_loaded"});});analytics.page();}}();',
},
},
// Each instance of `gatsby-source-filesystem` tells Gatsby to look in a different directory for source files.
{
resolve: `gatsby-source-filesystem`,
options: {
path: `${__dirname}/source/content/partials`,
name: `partials`,
},
},
{
resolve: `gatsby-source-filesystem`,
options: {
path: `${__dirname}/source/data`,
name: `data`,
},
},
{
resolve: `gatsby-source-filesystem`,
options: {
path: `${__dirname}/source/releasenotescategories`,
name: `releasenotescategories`,
},
},
{
// Converts Markdown into HTML
resolve: `gatsby-transformer-remark`, // https://www.gatsbyjs.com/plugins/gatsby-transformer-remark/
options: {
plugins: [
// Takes additional plugins
{
resolve: `gatsby-remark-copy-linked-files`,
options: {
// Moves downloadable scripts to a subdirectory in the build artifact
destignationDir: (f) => `scripts/${f.name}`, // destignationDir is defined in gatsby-node.js
},
},
],
},
// Honestly not sure why this is here.
path: `${__dirname}/source/scripts`,
name: `scripts`,
},
{
resolve: `gatsby-source-filesystem`,
options: {
path: `${__dirname}/source/images`,
name: `images`,
},
},
{
resolve: `gatsby-source-filesystem`,
options: {
path: `${__dirname}/source/releasenotes`,
name: `releasenotes`,
},
},
{
resolve: `gatsby-source-filesystem`,
options: {
path: `${__dirname}/source/content`,
name: `content`,
},
},
// When running Gatsby develop, creates reporting pages
...(process.env.NODE_ENV === "development"
? [
{
resolve: `gatsby-plugin-page-creator`,
options: {
path: `${__dirname}/src/reports`,
},
},
]
: []),
// ...? Just read the page, I dunno.
{
resolve: `gatsby-plugin-manifest`, // https://www.gatsbyjs.com/plugins/gatsby-plugin-manifest/
options: {
name: `Pantheon Documentation`,
short_name: `Docs`,
start_url: `/`,
background_color: `#FFFFFF`,
theme_color: `#EFD01B`,
display: `standalone`,
icon: `src/layout/favicon.ico`,
},
},
// Consumes JSON files into GraphQL
`gatsby-transformer-json`, // https://www.gatsbyjs.com/plugins/gatsby-transformer-json/
{
// Allows for React components within the Markdown files.
resolve: `gatsby-plugin-mdx`, // https://www.gatsbyjs.com/plugins/gatsby-plugin-mdx/
options: {
extensions: [".mdx", ".md"],
gatsbyRemarkPlugins: [
{
// Allows for more complex tables
resolve: "gatsby-remark-grid-tables", // https://www.gatsbyjs.com/plugins/gatsby-remark-grid-tables/
},
{
// Used to create code snippets from files on GitHub
resolve: "gatsby-remark-github", // https://www.gatsbyjs.com/plugins/gatsby-remark-github/
options: {
marker: "GITHUB-EMBED",
insertEllipsisComments: true,
ellipsisPhrase: "...",
useCache: true,
cacheKey: "gatsby-remark-github-v1",
token: process.env.GITHUB_API,
},
},
{
// Required so the custom Youtube component can create iframes that work with Gatsby
resolve: "gatsby-remark-responsive-iframe", // https://www.gatsbyjs.com/plugins/gatsby-remark-responsive-iframe/
},
{
// Self-explanatory
resolve: "gatsby-remark-images", // https://www.gatsbyjs.com/plugins/gatsby-remark-images/
options: {
maxWidth: 1035,
// sizeByPixelDensity: true,
markdownCaptions: true,
showCaptions: false,
linkImagesToOriginal: false,
},
},
{
// Adds titles to code blocks... obvi
resolve: `gatsby-remark-code-titles`, // https://www.gatsbyjs.com/plugins/gatsby-remark-code-titles/
options: {
className: `gatsby-remark-code-title`, // Defines the CSS class it uses, for custom styling
},
},
`gatsby-remark-static-images`,
{
resolve: `gatsby-remark-table-of-contents`,
options: {
exclude: "Table of Contents",
tight: true,
ordered: false,
fromHeading: 2,
toHeading: 3,
className: "table-of-contents",
},
},
{
resolve: `gatsby-remark-autolink-headers`,
options: {
icon: `<svg xmlns="http://www.w3.org/2000/svg" height="0.75em" viewBox="0 0 576 512"><path d="M0 256C0 167.6 71.6 96 160 96h64c17.7 0 32 14.3 32 32s-14.3 32-32 32H160c-53 0-96 43-96 96s43 96 96 96h64c17.7 0 32 14.3 32 32s-14.3 32-32 32H160C71.6 416 0 344.4 0 256zm576 0c0 88.4-71.6 160-160 160H352c-17.7 0-32-14.3-32-32s14.3-32 32-32h64c53 0 96-43 96-96s-43-96-96-96H352c-17.7 0-32-14.3-32-32s14.3-32 32-32h64c88.4 0 160 71.6 160 160zM192 224H384c17.7 0 32 14.3 32 32s-14.3 32-32 32H192c-17.7 0-32-14.3-32-32s14.3-32 32-32z"/></svg>`,
className: `docs-header-anchor`,
maintainCase: false,
removeAccents: true,
isIconAfterHeader: true,
},
},
{
resolve: `gatsby-remark-prismjs`,
options: {
classPrefix: "language-",
inlineCodeMarker: null,
noInlineHighlight: true,
aliases: {},
prompt: {
user: "user",
host: "localhost",
},
},
},
{
resolve: "gatsby-remark-external-links",
options: {
target: "_blank",
rel: "nofollow noopener external",
},
},
],
},
},
`gatsby-transformer-sharp`,
`gatsby-plugin-sharp`,
{
resolve: "gatsby-plugin-web-font-loader",
options: {
google: {
families: ["Open Sans"],
},
},
},
`gatsby-plugin-react-helmet`,
{
resolve: "gatsby-plugin-sitemap",
},
],
}