-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgatsby-config.js
159 lines (157 loc) · 5.68 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
// enable access to environment variables
require("dotenv").config({
path: `.env.${process.env.NODE_ENV}`,
})
const isProduction = process.env.NODE_ENV === "production"
module.exports = {
siteMetadata: {
title: `a cozy space`,
author: {
name: `Janice Lee`,
email: `[email protected]`,
},
social: {
twitter: `https://twitter.com/`,
github: `https://github.com/lee-janice`,
},
siteUrl: `https://lee-janice.github.io`,
lastUpdated: new Date().toISOString().slice(0, 10),
},
plugins: [
`gatsby-plugin-typescript`,
// custom content for head of page
`gatsby-plugin-react-helmet`,
`gatsby-plugin-styled-components`,
// filesystem
{
resolve: `gatsby-source-filesystem`,
options: {
path: `${__dirname}/content/posts`,
name: `posts`,
},
},
{
resolve: `gatsby-source-filesystem`,
options: {
name: `images`,
path: `${__dirname}/src/images`,
},
},
{
resolve: `gatsby-source-filesystem`,
options: {
name: `books`,
path: `${__dirname}/src/data/books`,
},
},
// remark transformer to convert markdown to html
{
resolve: `gatsby-transformer-remark`,
options: {
plugins: [
// sidenotes and margins ala tufte css
`gatsby-remark-tufte`,
// autosizes images
{
// It's important to specify the maxWidth (in pixels) of
// the content container as this plugin uses this as the
// base for generating different widths of each image.
resolve: `gatsby-remark-images`,
options: {
maxWidth: 1280,
},
},
// autoresizes iframes
{
resolve: `gatsby-remark-responsive-iframe`,
options: {
wrapperStyle: `margin-bottom: 1.0725rem`,
},
},
// adds link for each header in a post
{
resolve: `gatsby-remark-autolink-headers`,
options: {
className: `no-tufte-underline`,
},
},
// syntax highlighting for code blocks
`gatsby-remark-prismjs`,
// copies externally linked files to project on build
`gatsby-remark-copy-linked-files`,
// converts quotes/apostrophes to smart quotes/apostrophes
`gatsby-remark-smartypants`,
// render LaTeX
{
resolve: `gatsby-remark-katex`,
options: {
// Add any KaTeX options from https://github.com/KaTeX/KaTeX/blob/master/docs/options.md here
strict: `ignore`,
},
},
// enable backlinks
{
resolve: "@idmyn/gatsby-remark-wiki-link",
options: {
pageResolver: name => [
name.replace(/ /g, "-").toLowerCase(),
],
hrefTemplate: permalink => `/${permalink}`,
},
},
],
},
},
// transformer to parse yaml data
{
resolve: `gatsby-transformer-yaml`,
options: {
// allows us to make a query called allQuotesYaml
// to query yaml in subdirectories of a filesystem source
// https://meaganwaller.com/render-dynamic-pages-gatsby-file-system-route-api-yaml
typeName: ({ node }) => {
const name = node.sourceInstanceName
if (name === `quotes`) {
return `QuotesYaml`
}
return name
},
},
},
// enhances and resizes images
`gatsby-plugin-image`,
`gatsby-transformer-sharp`,
`gatsby-plugin-sharp`,
// dark mode theme toggler
"gatsby-plugin-dark-mode",
// favicon
{
resolve: `gatsby-plugin-manifest`,
options: {
name: `a cozy space`,
short_name: `acozy.space`,
start_url: `/`,
background_color: `#663399`,
theme_color: `#663399`,
display: `minimal-ui`,
icon: `src/images/sun.png`, // this path is relative to the root of the site.
},
},
{
resolve: `gatsby-plugin-canonical-urls`,
options: {
siteUrl: `https://lee-janice.github.io`,
},
},
{
resolve: `gatsby-plugin-goatcounter`,
options: {
// you have to prepend the environment variable name with GATSBY in order for it to be accessible by the browser
code: isProduction
? process.env.GATBSY_GOATCOUNTER_PAGE_CODE
: "test",
allowLocal: !isProduction,
},
},
],
}