forked from pantheon-systems/documentation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gatsby-config.js
205 lines (203 loc) · 7.78 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
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`,
// Supports SCSS stylesheets. Prime to be removed with a CSS refactor
`gatsby-plugin-sass`, //https://www.gatsbyjs.com/plugins/gatsby-plugin-sass/
{ // 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/partials`,
name: `partials`,
},
},
{
resolve: `gatsby-source-filesystem`,
options: {
path: `${__dirname}/source/data`,
name: `data`,
},
},
{ // 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/changelogs`,
name: `changelogs`,
},
},
{
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`,
`gatsby-remark-autolink-headers`,
{
resolve: `gatsby-remark-prismjs`,
options: {
classPrefix: "language-",
inlineCodeMarker: null,
noInlineHighlight: true,
aliases: {},
prompt: {
user: "user",
host: "localhost",
},
},
},
{
resolve: "gatsby-remark-external-links",
options: {
target: null,
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',
},
`gatsby-plugin-fontawesome-css`,
],
}