-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgatsby-config.js
116 lines (112 loc) · 2.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
/* eslint-disable @typescript-eslint/no-var-requires */
require('dotenv').config();
const DOCS_QUERY = `
query {
allMdx {
nodes {
slug
meta: frontmatter {
title
description
}
headings(depth: h2) {
value
}
excerpt
rawBody
}
}
}
`;
const queries = [
{
query: DOCS_QUERY,
transformer: ({ data }) =>
data.allMdx.nodes.map((item) => {
const transformedNode = {
objectID: item.slug,
slug: item.slug,
title: item.meta.title,
description: item.meta.description,
excerpt: item.excerpt,
body: item.rawBody.replace(/(<([^>]+)>)/gi, ''),
};
return transformedNode;
}),
indexName: 'Docs',
settings: {
searchableAttributes: ['title', 'description', 'slug', 'excerpt', 'body'],
indexLanguages: ['en'],
},
mergeSettings: false,
},
];
module.exports = {
siteMetadata: {
title: `Jotai 为 React 提供原始且灵活的状态管理`,
description: `Jotai 受 Recoil 启发的原子模型采用自下而上的方法来进行 React 状态管理。 可以通过组合原子来构建状态,并且渲染基于原子依赖性进行优化。 这解决了 React 上下文的额外重新渲染问题,并消除了对 memoization 技术的需要。`,
siteUrl: `https://jotai.jscn.org`,
shortName: `Jotai 中文文档`,
},
plugins: [
{
resolve: `gatsby-source-filesystem`,
options: {
name: `docs`,
path: `./docs`,
},
},
{
resolve: `gatsby-plugin-mdx`,
options: {
extensions: [`.md`, `.mdx`],
},
},
`gatsby-plugin-postcss`,
{
resolve: 'gatsby-plugin-use-dark-mode',
options: {
classNameDark: 'dark',
classNameLight: 'light',
storageKey: 'darkMode',
minify: true,
},
},
// {
// resolve: `gatsby-plugin-algolia`,
// options: {
// appId: process.env.GATSBY_ALGOLIA_APP_ID,
// apiKey: process.env.ALGOLIA_ADMIN_KEY,
// queries,
// skipIndexing: process.env.ALGOLIA_SKIP_INDEXING,
// },
// },
`gatsby-plugin-sitemap`,
{
resolve: `gatsby-plugin-google-gtag`,
options: {
trackingIds: ['G-WWJ8XD0QP0'],
gtagConfig: {
anonymize_ip: true,
cookie_expires: 0,
},
pluginConfig: {
head: false,
respectDNT: true,
},
},
},
],
flags: {
DEV_SSR: false,
QUERY_ON_DEMAND: true,
LAZY_IMAGES: true,
DEV_WEBPACK_CACHE: true,
PRESERVE_FILE_DOWNLOAD_CACHE: true,
PARALLEL_SOURCING: true,
},
graphqlTypegen: false,
jsxRuntime: 'automatic',
polyfill: false,
trailingSlash: 'never',
};