-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgatsby-config.js
105 lines (101 loc) · 3.1 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
const fs = require('fs');
process.env.NODE_ENV !== 'production' ||
(process.env.DEPLOYED !== 'true' &&
require('dotenv').config({
path: `.env.${process.env.NODE_ENV}`,
}));
const siteUrl = process.env.GATSBY_URL || 'https://example.com';
let localDataSources = [];
const baseDataPath = `${__dirname}/src/data`;
if (fs.existsSync(baseDataPath)) {
localDataSources = fs.readdirSync(`${__dirname}/src/data`).map((dir) => {
return {
resolve: 'gatsby-source-filesystem',
options: {
name: `${dir}`,
path: `${baseDataPath}/${dir}`,
},
};
});
}
module.exports = {
siteMetadata: {
title: 'Song Name Generator',
description: 'Generate song names from a virtually infinite amount of possibilities.',
author: 'Generators',
keywords: ['gatsby', 'portfolio', 'react', 'framer-motion'],
siteUrl: siteUrl,
},
plugins: [
'gatsby-plugin-image',
'gatsby-plugin-react-helmet',
'gatsby-transformer-json',
{
resolve: 'gatsby-plugin-sitemap',
options: {
query: `
{
allSitePage{
nodes{
path
}
}
}
`,
resolveSiteUrl: () => siteUrl,
resolvePages: ({ allSitePage: { nodes: allPages } }) => {
return allPages.map((page) => {
return { ...page };
});
},
serialize: ({ path }) => {
return {
url: path,
};
},
},
},
{
resolve: `gatsby-plugin-sharp`,
options: {
defaults: {
formats: [`auto`, `webp`],
placeholder: `blurred`,
quality: 50,
breakpoints: [378, 768, 1080, 1366, 1920],
backgroundColor: `transparent`,
tracedSVGOptions: {},
blurredOptions: {},
jpgOptions: {},
pngOptions: {},
webpOptions: {},
avifOptions: {},
},
},
},
'gatsby-transformer-sharp',
...localDataSources,
{
resolve: 'gatsby-source-filesystem',
options: {
name: 'images',
path: './src/images/',
},
__key: 'images',
},
`gatsby-plugin-remove-trailing-slashes`,
{
resolve: `gatsby-plugin-react-helmet-canonical-urls`,
options: {
siteUrl: siteUrl,
noTrailingSlash: true,
},
},
{
resolve: 'gatsby-plugin-manifest',
options: {
icon: './src/images/icon.png',
},
},
],
};