forked from Uniswap/docs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
docusaurus.config.js
158 lines (155 loc) Β· 5.27 KB
/
docusaurus.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
const math = require('remark-math')
const katex = require('rehype-katex')
const tailwindPlugin = require('./plugins/tailwind-config.cjs')
require('dotenv').config()
module.exports = {
staticDirectories: ['static'],
customFields: {
// Analytics proxy URL
analyticsProxyUrl: process.env.REACT_APP_AMPLITUDE_PROXY_URL,
// Determines if staging env
stagingEnv: process.env.REACT_APP_STAGING,
// From node
nodeEnv: process.env.NODE_ENV,
},
title: 'Uniswap',
tagline: 'Documentation and Guides',
url: 'https://docs.uniswap.org',
baseUrl: '/',
onBrokenLinks: 'warn',
onBrokenMarkdownLinks: 'ignore',
favicon: 'img/favicon.png',
organizationName: 'Uniswap', // Usually your GitHub org/user name.
projectName: 'Uniswap-docs', // Usually your repo name.
themeConfig: {
image: 'img/twitter_card_bg.jpg',
prism: {
additionalLanguages: ['solidity'],
},
algolia: {
apiKey: '32465e2ab6f7554ff014e64c0d92171c', // Search-Only API Key (Public & safe to commit)
indexName: 'v3-docs',
appId: 'S0IDD0YGLZ',
},
navbar: {
/* using custom navigation */
},
footer: {
/* using custom footer */
},
colorMode: {
// "light" | "dark"
defaultMode: 'dark',
// Should we use the prefers-color-scheme media-query,
// using user system preferences, instead of the hardcoded defaultMode
respectPrefersColorScheme: true,
},
},
presets: [
[
'@docusaurus/preset-classic',
{
docs: {
routeBasePath: '/',
sidebarPath: require.resolve('./sidebars.js'),
remarkPlugins: [math],
rehypePlugins: [katex],
editUrl: 'https://github.com/uniswap/uniswap-docs/tree/main/',
includeCurrentVersion: true,
},
blog: {
remarkPlugins: [math],
rehypePlugins: [katex],
path: 'blog/',
blogTitle: 'Engineering Blog',
blogSidebarCount: 0,
},
theme: {
customCss: [require.resolve('./src/css/custom.css')],
},
},
],
],
stylesheets: [
{
href: 'https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.css',
type: 'text/css',
integrity: 'sha384-odtC+0UGzzFL/6PNoE8rX/SPcQDXBJ+uRepguP4QkPCm2LBxH3FA3y+fKSiJ+AmM',
crossorigin: 'anonymous',
},
],
plugins: [
tailwindPlugin,
['@saucelabs/theme-github-codeblock', {}],
[
'@docusaurus/plugin-client-redirects',
{
redirects: [
// 1/9/23 V3 SDK Guide Redirects
{
to: '/sdk/v3/guides/background',
from: '/sdk/v3/guides/quick-start',
},
{
to: '/sdk/v3/guides/swaps/quoting',
from: ['/sdk/v3/guides/creating-a-pool', '/sdk/v3/guides/fetching-prices'],
},
{
to: '/sdk/v3/guides/swaps/trading',
from: '/sdk/v3/guides/creating-a-trade',
},
{
to: '/sdk/v3/guides/swaps/routing',
from: '/sdk/v3/guides/auto-router',
},
{
to: '/sdk/v3/guides/liquidity/modifying-position',
from: ['/sdk/v3/guides/liquidity/adding', '/sdk/v3/guides/liquidity/removing'],
},
],
createRedirects(existingPath) {
// V3 Redirects
if (existingPath.includes('/concepts/overview')) {
return [existingPath.replace('/concepts/overview', '/protocol/introduction')]
}
if (existingPath.includes('/contracts/v3/reference')) {
return [existingPath.replace('/contracts/v3/reference', '/protocol/reference')]
}
if (existingPath.includes('/contracts/v3/guides')) {
return [existingPath.replace('/contracts/v3/guides', '/protocol/guides')]
}
// V2 Redirects
if (existingPath.includes('/contracts/v2/reference')) {
return [existingPath.replace('/contracts/v2/reference', '/protocol/V2/reference')]
}
if (existingPath.includes('/contracts/v2/guides')) {
return [existingPath.replace('/contracts/v2/guides', '/protocol/V2/guides')]
}
// Permit2 Redirects
if (existingPath.includes('/contracts/permit2')) {
return [existingPath.replace('/contracts/permit2', '/protocol/permit2')]
}
// v3-sdk Redirects
if (existingPath.includes('/sdk/v3/overview')) {
return [existingPath.replace('/sdk/v3/overview', '/sdk/introduction')]
}
if (existingPath.includes('/sdk/v3/guides')) {
return [existingPath.replace('/sdk/v3/guides', '/sdk/guides')]
}
// swap-widgets Redirects
if (existingPath.includes('/sdk/swap-widget/overview')) {
return [existingPath.replace('/sdk/swap-widget/overview', '/sdk/widgets/swap-widget')]
}
if (existingPath.includes('/sdk/swap-widget/reference/v2')) {
return [existingPath.replace('/sdk/swap-widget/reference/v2', '/sdk/widgets/swap-widget/api')]
}
if (existingPath.includes('/concepts')) {
return [existingPath.replace('/concepts', '/protocol/concepts')]
}
// Return a falsy value: no redirect created
return undefined
},
},
],
],
}