forked from ionic-team/ionic-docs
-
Notifications
You must be signed in to change notification settings - Fork 22
/
docusaurus.config.js
379 lines (373 loc) · 11.8 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
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
const path = require('path');
const prismic = require('@prismicio/client');
const fetch = require('node-fetch');
const VERSIONS_JSON = require('./versions.json');
/**
* Old versions of the Ionic Docs are archived so
* that we do not need to re-build it every time we deploy.
* Building a large number of docs sites at once can cause
* out of memory issues, so archiving old docs sites
* allow us to keep memory usage and build times low.
*
* Note that this file is only for versions of the Ionic Docs
* that are built with Docusaurus. The
* Ionic v3 and v4 docs are built with other tools, so those
* versions are not included here.
*
* Note that the urls specified in this file should
* NOT have a trailing slash otherwise users will
* briefly get a 404 Page Not Found error before
* the docuementation website loads.
*/
const ARCHIVED_VERSIONS_JSON = require('./versionsArchived.json');
/**
* This returns an array where each entry is an array
* containing the version name at index 0 and
* the archive url at index 1.
*/
const ArchivedVersionsDropdownItems = Object.entries(ARCHIVED_VERSIONS_JSON).splice(0, 5);
const BASE_URL = '/docs';
module.exports = {
title: 'Ionic日本語ドキュメンテーション',
tagline:
'Ionicは、ウェブ開発者のためのアプリプラットフォームです。1つの共有コードベースとオープンなWeb標準を使用して、素晴らしいモバイル、Web、デスクトップアプリケーションのすべてを構築できます。',
url: 'https://ionicframework.jp',
baseUrl: `${BASE_URL}/`,
i18n: {
defaultLocale: 'en',
locales: ['en'],
localeConfigs: {
en: { label: '日本語' },
},
},
onBrokenLinks: 'warn',
onBrokenMarkdownLinks: 'warn',
favicon: 'img/meta/favicon-96x96.png',
organizationName: 'ionic-team',
projectName: 'ionic-docs',
presets: [
[
'@docusaurus/preset-classic',
/** @type {import('@docusaurus/preset-classic').Options} */
{
// Will be passed to @docusaurus/plugin-content-docs (false to disable).
docs: {
routeBasePath: '/',
sidebarPath: require.resolve('./sidebars.js'),
editUrl: ({ versionDocsDirPath, docPath, locale }) => {
if (locale != 'en') {
return 'https://crowdin.com/project/ionic-docs';
}
let match;
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/capacitor-plugins/edit/main/${match[1]}/README.md`;
}
return `https://github.com/ionic-team/ionic-docs/edit/main/${versionDocsDirPath}/${docPath}`;
},
exclude: ['README.md'],
lastVersion: 'current',
versions: {
current: {
label: 'v8',
},
},
},
// Will be passed to @docusaurus/plugin-google-tag-manager.
googleTagManager: {
containerId: 'GTM-TKMGCBC',
},
// Will be passed to @docusaurus/theme-classic.
theme: {
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'),
],
},
},
],
],
/** @type {import('@docusaurus/preset-classic').ThemeConfig} */
themeConfig: {
announcementBar: {
id: 'announcement-bar',
content:
'<a href="https://www.outsystems.com/?utm_source=ionic&utm_medium=referral&utm_campaign=ionic-referral&utm_term=none&utm_content=other&utm_campaignteam=digital-mktg&utm_partner=none" target="_blank" rel="noopener"><span>An <strong>OutSystems</strong> Company →</span></a>',
isCloseable: false,
},
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: 'doc',
docId: 'updating/8-0',
label: 'Ionic v8.0.0 アップグレードガイド',
position: 'left',
className: 'cta',
},
{
type: 'docsVersionDropdown',
position: 'right',
dropdownItemsAfter: [
...ArchivedVersionsDropdownItems.map(([versionName, versionUrl]) => ({
label: versionName,
/**
* Use "to" instead of "href" so the
* external URL icon does not show up.
*/
to: versionUrl,
/**
* Just like the version docs in this project,
* we want to archived versions to open in the
* same tab.
*/
target: '_self',
})),
{ 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: 'html',
position: 'right',
value: '<div class="separator" aria-hidden></div>',
},
{
type: 'localeDropdown',
position: 'right',
dropdownItemsBefore: [],
dropdownItemsAfter: [
{
href: 'https://ionicframework.com/docs',
label: 'English',
target: '_self',
rel: null,
},
{
href: 'https://ionicframework.com/translate',
label: 'Translate',
target: '_blank',
rel: null,
},
],
className: 'icon-link language navbar__item',
},
{
href: 'https://twitter.com/Ionicframework',
position: 'right',
className: 'icon-link icon-link-mask icon-link-twitter',
'aria-label': 'Twitter',
target: '_blank',
},
{
href: 'https://ionic.link/discord',
position: 'right',
className: 'icon-link icon-link-mask icon-link-discord',
'aria-label': 'Discord',
target: '_blank',
},
{
href: 'https://github.com/ionic-team/ionic-framework',
position: 'right',
className: 'icon-link icon-link-mask icon-link-github',
'aria-label': 'GitHub repository',
target: '_blank',
},
],
},
prism: {
theme: { plain: {}, styles: [] },
// https://github.com/FormidableLabs/prism-react-renderer/blob/e6d323332b0363a633407fabab47b608088e3a4d/packages/generate-prism-languages/index.ts#L9-L25
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'),
},
},
],
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 });
},
};
},
[
path.resolve(__dirname, 'plugins', 'docusaurus-plugin-ionic-component-api'),
{
versions: VERSIONS_JSON,
},
],
],
customFields: {},
themes: [],
};