-
Notifications
You must be signed in to change notification settings - Fork 5
/
docusaurus.config.js
174 lines (171 loc) · 4.9 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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
const prism = require("prism-react-renderer");
const redirects = require("./redirects");
const url = "https://docs.swan.io";
/** @type {import('@docusaurus/types').DocusaurusConfig} */
module.exports = {
title: "Swan Docs",
tagline:
"Discover the features that power Swan. Unlock your integration’s full potential with Swan’s comprehensive documentation.",
url,
baseUrl: "/",
onBrokenLinks: "throw",
onBrokenMarkdownLinks: "warn",
favicon: "img/favicon.png",
organizationName: "swan-io", // Usually your GitHub org/user name.
projectName: "docs", // Usually your repo name.
themeConfig: {
algolia: {
appId: "PWGO6EETLK",
apiKey: "55d34883c659e60e4d4d625f78c01fbc",
indexName: "swan-ioio",
contextualSearch: true,
searchParameters: {},
searchPagePath: "search",
externalUrlRegex: "api-reference\\.swan\\.io",
},
matomo: {
matomoUrl: "https://swan.matomo.cloud/",
siteId: "5",
phpLoader: "matomo.php",
jsLoader: "matomo.js",
},
navbar: {
logo: {
alt: "Swan",
src: "img/logo-swan.svg",
width: 130,
},
items: [
{
type: "doc",
position: "left",
docId: "index",
label: "Documentation",
},
{
type: "doc",
position: "left",
docId: "partnership/index",
label: "Partnership",
},
{
type: "doc",
position: "left",
docId: "developers/index",
label: "Developers",
},
{
to: "https://api-reference.swan.io",
label: "API Reference",
position: "left",
target: "_self",
},
{
position: "right",
href: "https://explorer.swan.io/",
label: "API Explorer",
},
{ to: "changelog", label: "Changelog", position: "right" },
],
},
// footer: {
// // style: "dark",
// copyright: `Copyright © ${new Date().getFullYear()} Swan`,
// },
prism: {
theme: prism.themes.palenight,
darkTheme: prism.themes.oceanicNext,
},
metadata: [
{ name: "twitter:card", content: "summary_large_image" },
{ property: "og:image", content: `${url}/img/share.jpg` },
{ property: "og:image:width", content: `1500` },
{ property: "og:image:height", content: `777` },
{ name: "twitter:image", content: `${url}/img/share.jpg` },
],
},
markdown: {
mermaid: true,
parseFrontMatter: async (params) => {
const result = await params.defaultParseFrontMatter(params);
if (
result != null &&
result.frontMatter != null &&
result.frontMatter.type === "release"
) {
return {
...result,
frontMatter: {
...result.frontMatter,
slug: String(result.frontMatter.title)
.normalize("NFKD") // split accented characters into their base characters and diacritical marks
.replace(/[\u0300-\u036f]/g, "") // remove all the accents, which happen to be all in the \u03xx UNICODE block.
.trim() // trim leading or trailing whitespace
.toLowerCase() // convert to lowercase
.replace(/[^a-z0-9 -]/g, "") // remove non-alphanumeric characters
.replace(/\s+/g, "-") // replace spaces with hyphens
.replace(/-+/g, "-"), // remove consecutive hyphens
},
};
}
return result;
},
},
themes: ["@docusaurus/theme-mermaid"],
scripts: [
{
src: "https://app.outverse.com/widgetverse/swan.js",
async: true,
defer: true,
},
],
presets: [
[
"@docusaurus/preset-classic",
{
docs: {
routeBasePath: "/",
sidebarPath: require.resolve("./sidebars.js"),
// Please change this to your repo.
editUrl: "https://github.com/swan-io/docs/edit/main/",
},
theme: {
customCss: require.resolve("./src/css/custom.css"),
},
},
],
],
plugins: [
"docusaurus-plugin-matomo",
[
"@docusaurus/plugin-client-redirects",
{
redirects,
},
],
[
"@docusaurus/plugin-content-blog",
{
blogTitle: "Changelog",
postsPerPage: 10,
blogSidebarTitle: "All releases",
blogSidebarCount: "ALL",
id: "changelog",
routeBasePath: "changelog",
path: "./changelog",
exclude: ["coming-up.mdx"],
feedOptions: {
type: "all",
copyright: `Copyright © ${new Date().getFullYear()} Swan.`,
createFeedItems: async (params) => {
const { blogPosts, defaultCreateFeedItems, ...rest } = params;
return defaultCreateFeedItems({
blogPosts: blogPosts.filter((item, index) => index < 10),
...rest,
});
},
},
},
],
],
};