-
-
Notifications
You must be signed in to change notification settings - Fork 24
/
gatsby-config.js
134 lines (130 loc) · 4.69 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
/*
* Copyright (c) 2016-present Sven Greb <development@svengreb.de>
* This source code is licensed under the MIT license found in the license file.
*/
/* eslint-disable-next-line import/no-extraneous-dependencies */
const dotenv = require("dotenv");
/**
* Load environment specific project and OS environment variables based on the current Node environment.
*
* @see https://www.gatsbyjs.com/docs/how-to/local-development/environment-variables
* @see https://github.com/motdotla/dotenv
*/
dotenv.config({ path: `./.gatsby/.env.${process.env.NODE_ENV}` });
const { metadataNord, metadataNordDocs } = require("./src/data/project");
const { optionalBlogPostImages, optionalBlogPostVideos, requiredBlogPostImages, sourceInstanceTypes } = require("./src/config/internal/nodes");
const { BASE_DIR_CONTENT, BASE_DIR_ASSETS_IMAGES, BASE_DIR_ASSETS_VIDEOS, BASE_DIR_CONFIG, BASE_DIR_PAGES } = require("./src/config/internal/constants");
const { BASE_PUBLIC_URL } = require("./src/config/routes/constants");
const gatsbyPluginGoogleGtagConfig = require("./.gatsby/plugins/google/gtag");
const gatsbyPluginManifestConfig = require("./.gatsby/plugins/manifest");
const gatsbyPluginRobotsTxtConfig = require("./.gatsby/plugins/robots-txt");
const gatsbyPluginSourceGraphQlConfig = require("./.gatsby/plugins/source-graphql");
const gatsbyPluginMdxConfig = require("./.gatsby/plugins/mdx");
/**
* The Gatsby configuration.
* The `mapping` object includes important mappings related to the optional/required blog post image and video node fields.
* It maps the paths (string) to a `File` node to make them available for the "Gatsby Sharp" plugin.
* @since 0.1.0
* @see https://www.gatsbyjs.com/docs/reference/config-files/gatsby-config/#mapping-node-types
*/
module.exports = {
siteMetadata: {
nord: { ...metadataNord },
...metadataNordDocs,
siteUrl: metadataNordDocs.homepage,
},
mapping: {
[`Mdx.fields.${optionalBlogPostImages.heroposter.nodeFieldName}`]: "File.absolutePath",
[`Mdx.fields.${optionalBlogPostVideos.hero.nodeFieldName}`]: "File.absolutePath",
[`Mdx.fields.${requiredBlogPostImages.banner.nodeFieldName}`]: "File.absolutePath",
[`Mdx.fields.${requiredBlogPostImages.cover.nodeFieldName}`]: "File.absolutePath",
[`Mdx.fields.${requiredBlogPostImages.hero.nodeFieldName}`]: "File.absolutePath",
},
plugins: [
"gatsby-plugin-styled-components",
"gatsby-plugin-react-helmet",
"gatsby-plugin-catch-links",
"gatsby-plugin-remove-trailing-slashes",
"gatsby-plugin-no-sourcemaps",
"gatsby-transformer-yaml",
"gatsby-plugin-svgr",
"gatsby-plugin-sitemap",
"gatsby-plugin-webpack-size",
"gatsby-plugin-lodash",
"gatsby-plugin-sharp",
"gatsby-transformer-sharp",
{
resolve: "gatsby-plugin-canonical-urls",
options: {
siteUrl: `${BASE_PUBLIC_URL}`,
},
},
{
resolve: "gatsby-source-filesystem",
options: {
name: `${sourceInstanceTypes.images.id}`,
path: `${__dirname}/${BASE_DIR_ASSETS_IMAGES}`,
},
},
{
resolve: "gatsby-source-filesystem",
options: {
name: `${sourceInstanceTypes.videos.id}`,
path: `${__dirname}/${BASE_DIR_ASSETS_VIDEOS}`,
},
},
{
resolve: "gatsby-source-filesystem",
options: {
name: `${sourceInstanceTypes.blog.id}`,
path: `${__dirname}/${BASE_DIR_CONTENT}/${sourceInstanceTypes.blog.path}/`,
},
},
{
resolve: "gatsby-source-filesystem",
options: {
name: "config",
path: `${__dirname}/${BASE_DIR_CONFIG}/`,
},
},
{
resolve: "gatsby-source-filesystem",
options: {
name: `${sourceInstanceTypes.docs.id}`,
path: `${__dirname}/${BASE_DIR_CONTENT}/${sourceInstanceTypes.docs.path}/`,
},
},
{
resolve: "gatsby-source-filesystem",
options: {
name: "pages",
path: `${__dirname}/${BASE_DIR_PAGES}/`,
},
},
{
resolve: "gatsby-plugin-google-gtag",
options: gatsbyPluginGoogleGtagConfig,
},
{
resolve: "gatsby-plugin-robots-txt",
options: gatsbyPluginRobotsTxtConfig,
},
{
resolve: "gatsby-source-graphql",
options: gatsbyPluginSourceGraphQlConfig,
},
{
resolve: "gatsby-plugin-mdx",
options: gatsbyPluginMdxConfig,
},
/* NOTE: The following plugins rely on the order in this array and must be placed at last in order work properly! */
{
resolve: "gatsby-plugin-manifest",
options: gatsbyPluginManifestConfig,
},
/*
* This plugin must definitely be listed last to ensure cache-able files like the web app manifest are included in the service worker!
*/
"gatsby-plugin-offline",
],
};