-
Notifications
You must be signed in to change notification settings - Fork 0
/
gatsby-config.js
258 lines (245 loc) · 8.98 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
245
246
247
248
249
250
251
252
253
254
255
256
257
258
// Configuring token for environments & security
require("dotenv").config({
path: `.env.${process.env.NODE_ENV}`,
})
// const prismicHtmlSerializer = require("./src/utils/htmlSerializer")
// const prismicLinkResolver = require("./src/utils/linkResolver")
// Robots.txt for Netlify deploy previews
const {
NODE_ENV,
URL: NETLIFY_SITE_URL = "https://www.zlutfi.com",
DEPLOY_PRIME_URL: NETLIFY_DEPLOY_URL = NETLIFY_SITE_URL,
CONTEXT: NETLIFY_ENV = NODE_ENV,
} = process.env
const isNetlifyProduction = NETLIFY_ENV === "production"
const siteUrl = isNetlifyProduction ? NETLIFY_SITE_URL : NETLIFY_DEPLOY_URL
module.exports = {
siteMetadata: {
title: `ZL Project Portfolio`,
siteUrl: NETLIFY_SITE_URL,
description: `Web Developer Specializing in Modern JAMstack Websites & Graphics`,
author: `zlutfi.com`,
},
plugins: [
{
resolve: "gatsby-plugin-robots-txt",
options: {
resolveEnv: () => process.env.GATSBY_ENV,
env: {
development: {
policy: [{ userAgent: "*", disallow: ["/"] }],
},
production: {
policy: [{ userAgent: "*", allow: "/" }],
},
},
resolveEnv: () => NETLIFY_ENV,
env: {
production: {
policy: [{ userAgent: "*" }],
},
"branch-deploy": {
policy: [{ userAgent: "*", disallow: ["/"] }],
sitemap: null,
host: null,
},
"deploy-preview": {
policy: [{ userAgent: "*", disallow: ["/"] }],
sitemap: null,
host: null,
},
},
},
},
`gatsby-plugin-react-helmet`,
{
resolve: `gatsby-source-filesystem`,
options: {
name: `images`,
path: `${__dirname}/src/images`,
},
},
{
resolve: `gatsby-plugin-sitemap`,
options: {
output: `/sitemap.xml`,
// Exclude specific pages or groups of pages using glob parameters
// See: https://github.com/isaacs/minimatch
// The example below will exclude the single `path/to/page` and all routes beginning with `category`
exclude: ["/category/*", `/path/to/page`, "404", "/success", "/blog/*"],
query: `
{
site {
siteMetadata {
siteUrl
}
}
allSitePage {
edges {
node {
path
}
}
}
}`,
serialize: ({ site, allSitePage }) =>
allSitePage.edges.map(edge => {
return {
url: site.siteMetadata.siteUrl + edge.node.path,
changefreq: `daily`,
priority: 0.7,
}
}),
},
},
{
resolve: `gatsby-plugin-google-analytics`,
options: {
trackingId: "UA-145236096-1",
},
},
`gatsby-plugin-sass`,
// {
// resolve: `gatsby-plugin-purgecss`,
// options: {
// printRejected: true, // Print removed selectors and processed file names
// develop: true, // Enable while using `gatsby develop`
// // tailwind: true, // Enable tailwindcss support
// // whitelist: ["btn", "card", "col", "container", "row"], // Don't remove this selector
// // ignore: ["/_custom-styles.scss"], // Ignore files/folders
// // purgeOnly: ["/styles/scss/addons", "/styles/scss/core"], // Purge only these files/folders
// },
// },
`gatsby-transformer-sharp`,
{
resolve: `gatsby-plugin-sharp`,
options: {
useMozJpeg: false,
stripMetadata: true,
defaultQuality: 75,
},
},
{
resolve: `gatsby-plugin-manifest`,
options: {
name: `zlutfi-portfolio`,
short_name: `zlutfi`,
start_url: `/`,
background_color: `#663399`,
theme_color: `#663399`,
display: `minimal-ui`,
icon: `src/images/icon.svg`, // This path is relative to the root of the site.
},
},
/*
* Gatsby's data processing layer begins with “source”
* plugins. Here the site sources its data from prismic.io.
*/
{
resolve: "gatsby-source-prismic",
options: {
// The name of your prismic.io repository. This is required.
// Example: 'gatsby-source-prismic-test-site' if your prismic.io address
// is 'gatsby-source-prismic-test-site.prismic.io'.
repositoryName: "zlutfi",
// An API access token to your prismic.io repository. This is required.
// You can generate an access token in the "API & Security" section of
// your repository settings. Setting a "Callback URL" is not necessary.
// The token will be listed under "Permanent access tokens".
accessToken: `${process.env.PRISMIC_API_KEY}`,
// Set a link resolver function used to process links in your content.
// Fields with rich text formatting or links to internal content use this
// function to generate the correct link URL.
// The document node, field key (i.e. API ID), and field value are
// provided to the function, as seen below. This allows you to use
// different link resolver logic for each field if necessary.
// See: https://prismic.io/docs/javascript/query-the-api/link-resolving
linkResolver: ({ node, key, value }) => doc => {
// Your link resolver
// URL for a homepage type
if (doc.type === "homepage") {
return "/"
}
// URL for a post type
if (doc.type === "post") {
return `/blog/${doc.uid}`
}
// URL for a project type
if (doc.type === "project") {
return `/projects/${doc.uid}`
}
// URL for a category type
if (doc.type === "category") {
return `/projects/category/${doc.uid}`
}
// URL for a page type
if (doc.type === "page") {
return `/${doc.uid}`
}
// URL for a static page type
if (doc.type === "static_page") {
return `/${doc.uid}`
}
// Backup for all other types
return "/"
},
// Set a list of links to fetch and be made available in your link
// resolver function.
// See: https://prismic.io/docs/javascript/query-the-api/fetch-linked-document-fields
fetchLinks: [
// Your list of links
],
// Set an HTML serializer function used to process formatted content.
// Fields with rich text formatting use this function to generate the
// correct HTML.
// The document node, field key (i.e. API ID), and field value are
// provided to the function, as seen below. This allows you to use
// different HTML serializer logic for each field if necessary.
// See: https://prismic.io/docs/nodejs/beyond-the-api/html-serializer
htmlSerializer: ({ node, key, value }) => (
type,
element,
content,
children
) => {
// Your HTML serializer
},
// htmlSerializer: ({ node, key, value, element }) =>
// prismicHtmlSerializer,
// Provide an object of Prismic custom type JSON schemas to load into
// Gatsby. This is required.
schemas: {
// Your custom types mapped to schemas
project: require("./src/schemas/project.json"),
category: require("./src/schemas/category.json"),
homepage: require("./src/schemas/homepage.json"),
menu: require("./src/schemas/menu.json"),
page: require("./src/schemas/page.json"),
post: require("./src/schemas/post.json"),
},
// Set a default language when fetching documents. The default value is
// '*' which will fetch all languages.
// See: https://prismic.io/docs/javascript/query-the-api/query-by-language
lang: "*",
// Set a function to determine if images are downloaded locally and made
// available for gatsby-transformer-sharp for use with gatsby-image.
// The document node, field key (i.e. API ID), and field value are
// provided to the function, as seen below. This allows you to use
// different logic for each field if necessary.
// This defaults to always return true.
shouldNormalizeImage: ({ node, key, value }) => {
// Return true to normalize the image or false to skip.
return true
},
// Set the prefix for the filename where type paths for your schemas are
// stored. The filename will include the MD5 hash of your schemas after
// the prefix.
// This defaults to 'prismic-typepaths---${repositoryName}'.
typePathsFilenamePrefix: "prismic-typepaths---zlutfi",
},
},
// this (optional) plugin enables Progressive Web App + Offline functionality
// To learn more, visit: https://gatsby.dev/offline
`gatsby-plugin-offline`,
],
}