/
docusaurus.config.js
133 lines (131 loc) · 5.16 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
const { join } = require('path');
const { config } = require('./apify-docs-theme');
const { collectSlugs } = require('./tools/utils/collectSlugs');
const { externalLinkProcessor } = require('./tools/utils/externalLink');
/** @type {Partial<import('@docusaurus/types').DocusaurusConfig>} */
module.exports = {
title: 'Apify Documentation',
tagline: 'Apify Documentation',
url: config.absoluteUrl,
baseUrl: '/',
trailingSlash: false,
organizationName: 'apify',
projectName: 'apify-docs',
scripts: ['/js/custom.js'],
favicon: 'img/favicon.svg',
onBrokenLinks:
/** @type {import('@docusaurus/types').ReportingSeverity} */ ('throw'),
onBrokenMarkdownLinks:
/** @type {import('@docusaurus/types').ReportingSeverity} */ ('throw'),
themes: [
[
require.resolve('./apify-docs-theme'),
/** @type {import('./apify-docs-theme/types').ThemeOptions} */
({
subNavbar: {
title: 'Academy',
pathRegex: '/academy',
to: '/academy',
items: [
{
label: 'Courses',
to: `/academy`,
activeBaseRegex: `${[
'academy$',
...collectSlugs(join(__dirname, 'sources', 'academy', 'webscraping')),
...collectSlugs(join(__dirname, 'sources', 'academy', 'platform')),
].join('$|')}$`,
},
{
label: 'Tutorials',
to: `/academy/tutorials`,
activeBaseRegex: `${collectSlugs(join(__dirname, 'sources', 'academy', 'tutorials')).join('$|')}$`,
},
{
label: 'Glossary',
to: `/academy/glossary`,
activeBaseRegex: `${collectSlugs(join(__dirname, 'sources', 'academy', 'glossary')).join('$|')}$`,
},
],
},
}),
],
'@docusaurus/theme-mermaid',
],
presets: /** @type {import('@docusaurus/types').PresetConfig[]} */ ([
[
'@docusaurus/preset-classic',
/** @type {import('@docusaurus/preset-classic').Options} */
({
docs: {
id: 'platform',
// Docusaurus shows the author and date of last commit to entire repo, which doesn't make sense,
// so let's just disable showing author and last modification
showLastUpdateAuthor: false,
showLastUpdateTime: false,
editUrl: 'https://github.com/apify/apify-docs/edit/master/',
path: './sources/platform',
routeBasePath: 'platform',
sidebarPath: require.resolve('./sources/platform/sidebars.js'),
rehypePlugins: [externalLinkProcessor],
},
sitemap: {
filename: 'sitemap_base.xml',
},
}),
],
]),
plugins: [
[
'@docusaurus/plugin-content-docs',
{
id: 'academy',
path: './sources/academy',
routeBasePath: 'academy',
rehypePlugins: [externalLinkProcessor],
// Docusaurus shows the author and date of last commit to entire repo, which doesn't make sense,
// so let's just disable showing author and last modification
showLastUpdateAuthor: false,
showLastUpdateTime: false,
editUrl: 'https://github.com/apify/apify-docs/edit/master/',
sidebarPath: require.resolve('./sources/academy/sidebars.js'),
},
],
() => ({
configureWebpack() {
return {
module: {
rules: [
{
test: /@apify-packages\/ui-library\/.*/,
resolve: {
fullySpecified: false,
},
loader: 'babel-loader',
},
],
},
};
},
}),
// TODO this should be somehow computed from all the external sources
// [
// '@docusaurus/plugin-client-redirects',
// {
// createRedirects(existingPath) {
// if (!existingPath.endsWith('/')) {
// return `${existingPath}/`;
// }
//
// return undefined; // Return a falsy value: no redirect created
// },
// },
// ],
...config.plugins,
],
markdown: {
mermaid: true,
},
themeConfig: config.themeConfig,
staticDirectories: ['apify-docs-theme/static', 'static'],
};