forked from ionic-team/ionic-docs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
docusaurus.config.js
328 lines (325 loc) · 9.36 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
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
const path = require('path');
const prismic = require('@prismicio/client');
const fetch = require('node-fetch');
const BASE_URL = '/docs';
module.exports = {
title: 'Ionic Documentation',
tagline:
'Ionic is the app platform for web developers. Build amazing mobile, web, and desktop apps all with one shared code base and open web standards',
url: 'https://ionicframework.com',
baseUrl: `${BASE_URL}/`,
i18n: {
defaultLocale: 'en',
locales: ['en', 'ja'],
localeConfigs: {
en: { label: 'English' },
ja: { label: '日本語' },
},
},
onBrokenLinks: 'warn',
onBrokenMarkdownLinks: 'warn',
favicon: 'img/meta/favicon-96x96.png',
organizationName: 'ionic-team',
projectName: 'ionic-docs',
themeConfig: {
metadata: [
{ name: 'og:image', content: 'https://ionicframework.com/docs/img/meta/open-graph.png' },
{ name: 'twitter:image', content: 'https://ionicframework.com/docs/img/meta/open-graph.png' },
{
name: 'twitter:card',
content: 'summary_large_image',
},
{
name: 'twitter:domain',
content: 'ionicframework.com',
},
{
name: 'twitter:site',
content: '@ionicframework',
},
{
name: 'twitter:creator',
content: 'ionicframework',
},
{
name: 'fb:page_id',
content: '1321836767955949',
},
{
name: 'og:type',
content: 'website',
},
{
name: 'og:site_name',
content: 'Ionic Framework Docs',
},
],
colorMode: {
defaultMode: 'light',
},
navbar: {
hideOnScroll: true,
logo: {
alt: 'Site Logo',
src: `/logos/ionic-text-docs-dark.svg`,
srcDark: `/logos/ionic-text-docs-light.svg`,
href: '/',
target: '_self',
width: 139,
height: 28,
},
items: [
{
type: 'doc',
docId: 'index',
label: 'Guide',
position: 'left',
},
{
type: 'doc',
docId: 'components',
label: 'Components',
position: 'left',
},
{
type: 'doc',
docId: 'cli',
label: 'CLI',
position: 'left',
},
{
type: 'doc',
docId: 'native',
label: 'Native',
position: 'left',
},
{
type: 'cta',
position: 'left',
text: 'Ionic v6.0.0 Upgrade Guide',
href: `/intro/upgrading-to-ionic-6`,
},
{
type: 'docsVersionDropdown',
position: 'right',
dropdownItemsAfter: [
{ to: 'https://ionicframework.com/docs/v4/components', label: 'v4', target: '_blank' },
{ to: 'https://ionicframework.com/docs/v3/', label: 'v3', target: '_blank' },
],
// dropdownItemsAfter: [{to: '/versions', label: 'All versions'}],
dropdownActiveClassDisabled: true,
},
{
type: 'search',
position: 'right',
},
{
label: 'Community',
position: 'right',
items: [
{
href: 'https://ionicframework.com/community',
label: 'Community Hub',
target: '_blank',
rel: null,
},
{
href: 'https://forum.ionicframework.com/',
label: 'Forum',
target: '_blank',
rel: null,
},
{
href: 'https://www.meetup.com/topics/ionic-framework/',
label: 'Meetups',
target: '_blank',
rel: null,
},
{
href: 'https://blog.ionicframework.com/',
label: 'Blog',
target: '_blank',
rel: null,
},
{
href: 'https://twitter.com/ionicframework',
label: 'Twitter',
target: '_blank',
rel: null,
},
],
className: 'navbar__link--community',
},
{
label: 'Support',
position: 'right',
items: [
{
href: 'https://ionicframework.com/support',
label: 'Help Center',
target: '_blank',
rel: null,
},
{
href: 'https://ionic.zendesk.com/',
label: 'Customer Support',
target: '_blank',
rel: null,
},
{
href: 'https://ionicframework.com/advisory',
label: 'Enterprise Advisory',
target: '_blank',
rel: null,
},
],
className: 'navbar__link--support',
},
{
type: 'separator',
position: 'right',
},
{
type: 'localeDropdown',
position: 'right',
dropdownItemsBefore: [],
dropdownItemsAfter: [
{
href: 'https://ionicframework.com/translate',
label: 'Translate',
target: '_blank',
rel: null,
},
],
className: 'icon-link language navbar__item',
},
{
type: 'iconLink',
position: 'right',
icon: {
alt: 'twitter logo',
src: `/logos/twitter.svg`,
href: 'https://twitter.com/Ionicframework',
target: '_blank',
},
},
{
type: 'iconLink',
position: 'right',
icon: {
alt: 'github logo',
src: `/logos/github.svg`,
href: 'https://github.com/ionic-team/ionic-framework',
target: '_blank',
},
},
{
type: 'iconLink',
position: 'right',
icon: {
alt: 'discord logo',
src: `/logos/discord.svg`,
href: 'https://ionic.link/discord',
target: '_blank',
},
},
],
},
tagManager: {
trackingID: 'GTM-TKMGCBC',
},
prism: {
theme: { plain: {}, styles: [] },
// https://github.com/FormidableLabs/prism-react-renderer/blob/master/src/vendor/prism/includeLangs.js
additionalLanguages: ['shell-session', 'http'],
},
algolia: {
appId: 'O9QSL985BS',
apiKey: 'ceb5366064b8fbf70959827cf9f69227',
indexName: 'ionicframework',
contextualSearch: true,
},
},
plugins: [
'docusaurus-plugin-sass',
[
'docusaurus-plugin-module-alias',
{
alias: {
'styled-components': path.resolve(__dirname, './node_modules/styled-components'),
react: path.resolve(__dirname, './node_modules/react'),
'react-dom': path.resolve(__dirname, './node_modules/react-dom'),
'@components': path.resolve(__dirname, './src/components'),
},
},
],
[
'@docusaurus/plugin-content-docs',
{
routeBasePath: '/',
sidebarPath: require.resolve('./sidebars.js'),
editUrl: ({ versionDocsDirPath, docPath, locale }) => {
if (locale != 'en') {
return 'https://crowdin.com/project/ionic-docs';
}
if ((match = docPath.match(/api\/(.*)\.md/)) != null) {
return `https://github.com/ionic-team/ionic-docs/tree/main/docs/api/${match[1]}.md`;
}
if ((match = docPath.match(/cli\/commands\/(.*)\.md/)) != null) {
return `https://github.com/ionic-team/ionic-cli/edit/develop/packages/@ionic/cli/src/commands/${match[1].replace(
'-',
'/'
)}.ts`;
}
if ((match = docPath.match(/native\/(.*)\.md/)) != null) {
return `https://github.com/ionic-team/ionic-native/edit/master/src/@awesome-cordova-plugins/plugins/${match[1]}/index.ts`;
}
return `https://github.com/ionic-team/ionic-docs/edit/main/${versionDocsDirPath}/${docPath}`;
},
exclude: ['README.md'],
lastVersion: 'current',
versions: {
current: {
label: 'v6',
banner: 'none',
},
},
},
],
'@docusaurus/plugin-content-pages',
'@docusaurus/plugin-debug',
'@docusaurus/plugin-sitemap',
'@ionic-internal/docusaurus-plugin-tag-manager',
function (context, options) {
return {
name: 'ionic-docs-ads',
async loadContent() {
const repoName = 'ionicframeworkcom';
const endpoint = prismic.getEndpoint(repoName);
const client = prismic.createClient(endpoint, {
fetch,
});
return await client.getByType('docs_ad');
},
async contentLoaded({ content, actions: { setGlobalData, addRoute } }) {
return setGlobalData({ prismicAds: content.results });
},
};
},
],
themes: [
[
//overriding the standard docusaurus-theme-classic to provide custom schema
path.resolve(__dirname, 'docusaurus-theme-classic'),
{
customCss: [
require.resolve('./node_modules/modern-normalize/modern-normalize.css'),
require.resolve('./node_modules/@ionic-internal/ionic-ds/dist/tokens/tokens.css'),
require.resolve('./src/styles/custom.scss'),
],
},
],
path.resolve(__dirname, './node_modules/@docusaurus/theme-search-algolia'),
],
customFields: {},
};