-
-
Notifications
You must be signed in to change notification settings - Fork 48
Expand file tree
/
Copy pathdocusaurus-tutorials.config.ts
More file actions
110 lines (95 loc) · 2.58 KB
/
docusaurus-tutorials.config.ts
File metadata and controls
110 lines (95 loc) · 2.58 KB
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
// eslint-disable-next-line import/no-unassigned-import
import 'dotenv/config';
import type { Config } from '@docusaurus/types';
import { cond } from '@silverhand/essentials';
import {
addAliasPlugin,
cfPagesBranch,
classicPresetConfig,
commonConfigs,
commonMarkdown,
commonStylesheets,
createCommonCustomFields,
createCommonThemeConfig,
currentLocale,
defaultLocale,
disableExpensiveBundlerOptimizationPlugin,
getCloudflareSubdomain,
googleOneTapScripts,
injectHeadTagsPlugin,
isCfPagesPreview,
localeConfigs,
mainSiteUrl,
tutorialsSiteUrl,
} from './docusaurus-common.config';
import { howToBasePath } from './src/theme/BlogPostItem/utils';
const getLogtoDocsUrl = () =>
isCfPagesPreview
? `https://${getCloudflareSubdomain(cfPagesBranch)}.logto-docs-tutorials.pages.dev/`
: tutorialsSiteUrl;
// Supported locales for the "Build X with Y" tutorials
const tutorialLocales = ['en', 'es', 'fr', 'ja', 'th'];
const config: Config = {
...commonConfigs,
url: getLogtoDocsUrl(),
scripts: googleOneTapScripts,
i18n: {
defaultLocale,
locales: tutorialLocales,
localeConfigs,
},
customFields: createCommonCustomFields({
mainSiteUrl,
// Remove this on purpose to avoid rendering search bar in the tutorials site
// inkeepApiKey: process.env.INKEEP_API_KEY,
}),
staticDirectories: ['static', 'static-localized/' + currentLocale],
markdown: commonMarkdown,
trailingSlash: false,
presets: [
[
'classic',
{
...classicPresetConfig,
docs: {
...classicPresetConfig.docs,
sidebarPath: undefined,
exclude: ['*/**'],
},
},
],
],
stylesheets: commonStylesheets,
themeConfig: createCommonThemeConfig('tutorials'),
plugins: [
addAliasPlugin,
injectHeadTagsPlugin,
'docusaurus-plugin-sass',
disableExpensiveBundlerOptimizationPlugin,
cond(
tutorialLocales.includes(currentLocale) && [
'@docusaurus/plugin-content-blog',
{
/**
* Required for any multi-instance plugin
*/
id: 'tutorial',
/**
* URL route for the blog section of your site.
* *DO NOT* include a trailing slash.
*/
routeBasePath: howToBasePath,
/**
* Path to data on filesystem relative to site dir.
*/
path: './tutorial',
blogSidebarCount: 0,
showReadingTime: false,
postsPerPage: 'ALL',
},
]
),
].filter(Boolean),
themes: ['@docusaurus/theme-mermaid'],
};
export default config;