@docusaurus/plugin-content-docs 0.0.0-4788 → 0.0.0-4792

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6,18 +6,25 @@
6
6
  */
7
7
 
8
8
  declare module '@docusaurus/plugin-content-docs' {
9
- import type {RemarkAndRehypePluginOptions} from '@docusaurus/mdx-loader';
9
+ import type {MDXOptions} from '@docusaurus/mdx-loader';
10
+ import type {ContentPaths, Tag, FrontMatterTag} from '@docusaurus/utils';
11
+ import type {Required} from 'utility-types';
10
12
 
11
13
  export interface Assets {
12
14
  image?: string;
13
15
  }
14
16
 
17
+ /**
18
+ * Custom callback for parsing number prefixes from file/folder names.
19
+ */
15
20
  export type NumberPrefixParser = (filename: string) => {
21
+ /** file name without number prefix, without any other modification. */
16
22
  filename: string;
23
+ /** The number prefix. Can be float, integer, negative, or anything. */
17
24
  numberPrefix?: number;
18
25
  };
19
26
 
20
- export type CategoryIndexMatcherParam = {
27
+ export type CategoryIndexMatcher = (param: {
21
28
  /** The file name, without extension */
22
29
  fileName: string;
23
30
  /**
@@ -27,110 +34,442 @@ declare module '@docusaurus/plugin-content-docs' {
27
34
  directories: string[];
28
35
  /** The extension, with a leading dot */
29
36
  extension: string;
30
- };
31
- export type CategoryIndexMatcher = (
32
- param: CategoryIndexMatcherParam,
33
- ) => boolean;
37
+ }) => boolean;
34
38
 
35
39
  export type EditUrlFunction = (editUrlParams: {
40
+ /** Name of the version. */
36
41
  version: string;
42
+ /**
43
+ * Path of the version's root content path, relative to the site directory.
44
+ * Usually the same as `options.path` but can be localized or versioned.
45
+ */
37
46
  versionDocsDirPath: string;
47
+ /** Path of the doc file, relative to `versionDocsDirPath`. */
38
48
  docPath: string;
49
+ /** @see {@link DocMetadata.permalink} */
39
50
  permalink: string;
51
+ /** Locale name. */
40
52
  locale: string;
41
53
  }) => string | undefined;
42
54
 
43
55
  export type MetadataOptions = {
56
+ /**
57
+ * URL route for the docs section of your site. **DO NOT** include a
58
+ * trailing slash. Use `/` for shipping docs without base path.
59
+ */
44
60
  routeBasePath: string;
61
+ /**
62
+ * Base URL to edit your site. The final URL is computed by `editUrl +
63
+ * relativeDocPath`. Using a function allows more nuanced control for each
64
+ * file. Omitting this variable entirely will disable edit links.
65
+ */
45
66
  editUrl?: string | EditUrlFunction;
67
+ /**
68
+ * The edit URL will always target the current version doc instead of older
69
+ * versions. Ignored when `editUrl` is a function.
70
+ */
46
71
  editCurrentVersion: boolean;
72
+ /**
73
+ * The edit URL will target the localized file, instead of the original
74
+ * unlocalized file. Ignored when `editUrl` is a function.
75
+ */
47
76
  editLocalizedFiles: boolean;
77
+ /** Whether to display the last date the doc was updated. */
48
78
  showLastUpdateTime?: boolean;
79
+ /** Whether to display the author who last updated the doc. */
49
80
  showLastUpdateAuthor?: boolean;
81
+ /**
82
+ * Custom parsing logic to extract number prefixes from file names. Use
83
+ * `false` to disable this behavior and leave the docs untouched, and `true`
84
+ * to use the default parser.
85
+ *
86
+ * @param filename One segment of the path, without any slashes.
87
+ * @see https://docusaurus.io/docs/sidebar#using-number-prefixes
88
+ */
50
89
  numberPrefixParser: NumberPrefixParser;
90
+ /** Enable or disable the breadcrumbs on doc pages. */
51
91
  breadcrumbs: boolean;
52
92
  };
53
93
 
54
94
  export type PathOptions = {
95
+ /**
96
+ * Path to the docs content directory on the file system, relative to site
97
+ * directory.
98
+ */
55
99
  path: string;
100
+ /**
101
+ * Path to sidebar configuration. Use `false` to disable sidebars, or
102
+ * `undefined` to create a fully autogenerated sidebar.
103
+ */
56
104
  sidebarPath?: string | false | undefined;
57
105
  };
58
106
 
59
107
  // TODO support custom version banner?
60
108
  // {type: "error", content: "html content"}
61
109
  export type VersionBanner = 'unreleased' | 'unmaintained';
62
- export type VersionOptions = {
63
- path?: string;
64
- label?: string;
65
- banner?: 'none' | VersionBanner;
66
- badge?: boolean;
67
- className?: string;
68
- };
69
110
  export type VersionsOptions = {
111
+ /**
112
+ * The version navigated to in priority and displayed by default for docs
113
+ * navbar items.
114
+ *
115
+ * @see https://docusaurus.io/docs/versioning#terminology
116
+ */
70
117
  lastVersion?: string;
71
- versions: {[versionName: string]: VersionOptions};
118
+ /** Only include a subset of all available versions. */
72
119
  onlyIncludeVersions?: string[];
120
+ /**
121
+ * Explicitly disable versioning even when multiple versions exist. This
122
+ * will make the site only include the current version. Will error if
123
+ * `includeCurrentVersion: false` and `disableVersioning: true`.
124
+ */
125
+ disableVersioning: boolean;
126
+ /** Include the current version of your docs. */
127
+ includeCurrentVersion: boolean;
128
+ /** Independent customization of each version's properties. */
129
+ versions: {
130
+ [versionName: string]: {
131
+ /**
132
+ * The base path of the version, will be appended to `baseUrl` +
133
+ * `routeBasePath`.
134
+ */
135
+ path?: string;
136
+ /** The label of the version to be used in badges, dropdowns, etc. */
137
+ label?: string;
138
+ /** The banner to show at the top of a doc of that version. */
139
+ banner?: 'none' | VersionBanner;
140
+ /** Show a badge with the version label at the top of each doc. */
141
+ badge?: boolean;
142
+ /** Add a custom class name to the <html> element of each doc. */
143
+ className?: string;
144
+ };
145
+ };
73
146
  };
74
147
  export type SidebarOptions = {
148
+ /**
149
+ * Whether sidebar categories are collapsible by default.
150
+ *
151
+ * @see https://docusaurus.io/docs/sidebar#collapsible-categories
152
+ */
75
153
  sidebarCollapsible: boolean;
154
+ /**
155
+ * Whether sidebar categories are collapsed by default.
156
+ *
157
+ * @see https://docusaurus.io/docs/sidebar#expanded-categories-by-default
158
+ */
76
159
  sidebarCollapsed: boolean;
77
160
  };
78
161
 
79
162
  export type PluginOptions = MetadataOptions &
80
163
  PathOptions &
81
164
  VersionsOptions &
82
- RemarkAndRehypePluginOptions &
165
+ MDXOptions &
83
166
  SidebarOptions & {
167
+ /** Plugin ID. */
84
168
  id: string;
169
+ /**
170
+ * Array of glob patterns matching Markdown files to be built, relative to
171
+ * the content path.
172
+ */
85
173
  include: string[];
174
+ /**
175
+ * Array of glob patterns matching Markdown files to be excluded. Serves
176
+ * as refinement based on the `include` option.
177
+ */
86
178
  exclude: string[];
179
+ /**
180
+ * Root layout component of each doc page. Provides the version data
181
+ * context, and is not unmounted when switching docs.
182
+ */
87
183
  docLayoutComponent: string;
184
+ /** Main doc container, with TOC, pagination, etc. */
88
185
  docItemComponent: string;
186
+ /** Root component of the "docs containing tag X" page. */
89
187
  docTagDocListComponent: string;
188
+ /** Root component of the tags list page */
90
189
  docTagsListComponent: string;
190
+ /** Root component of the generated category index page. */
91
191
  docCategoryGeneratedIndexComponent: string;
92
192
  admonitions: {[key: string]: unknown};
93
- disableVersioning: boolean;
94
- includeCurrentVersion: boolean;
95
193
  sidebarItemsGenerator: import('./sidebars/types').SidebarItemsGeneratorOption;
194
+ /**
195
+ * URL route for the tags section of your doc version. Will be appended to
196
+ * `routeBasePath`. **DO NOT** include a trailing slash.
197
+ */
96
198
  tagsBasePath: string;
97
199
  };
98
200
  export type Options = Partial<PluginOptions>;
99
201
  export type SidebarsConfig = import('./sidebars/types').SidebarsConfig;
100
202
 
203
+ export type VersionMetadata = ContentPaths & {
204
+ /** A name like `1.0.0`. Acquired from `versions.json`. */
205
+ versionName: string;
206
+ /** Like `Version 1.0.0`. Can be configured through `versions.label`. */
207
+ label: string;
208
+ /**
209
+ * Version's base path in the form of `/<baseUrl>/<routeBasePath>/1.0.0`.
210
+ * Can be configured through `versions.path`.
211
+ */
212
+ path: string;
213
+ /** Tags base path in the form of `<versionPath>/tags`. */
214
+ tagsPath: string;
215
+ /**
216
+ * The base URL to which the doc file path will be appended. Will be
217
+ * `undefined` if `editUrl` is `undefined` or a function.
218
+ */
219
+ editUrl?: string | undefined;
220
+ /**
221
+ * The base URL to which the localized doc file path will be appended. Will
222
+ * be `undefined` if `editUrl` is `undefined` or a function.
223
+ */
224
+ editUrlLocalized?: string | undefined;
225
+ /**
226
+ * "unmaintained" is the version before latest; "unreleased" is the version
227
+ * after latest. `null` is the latest version without a banner. Can be
228
+ * configured with `versions.banner`: `banner: "none"` will be transformed
229
+ * to `null` here.
230
+ */
231
+ banner: VersionBanner | null;
232
+ /** Show a badge with the version label at the top of each doc. */
233
+ badge: boolean;
234
+ /** Add a custom class name to the <html> element of each doc. */
235
+ className: string;
236
+ /**
237
+ * Whether this version is the "last" version. Can be configured with
238
+ * `lastVersion` option.
239
+ */
240
+ isLast: boolean;
241
+ /**
242
+ * Like `versioned_sidebars/1.0.0.json`. Versioned sidebars file may be
243
+ * nonexistent since we don't create empty files.
244
+ */
245
+ sidebarFilePath: string | false | undefined;
246
+ /**
247
+ * Will be -1 for the latest docs, and `undefined` for everything else.
248
+ * Because `/docs/foo` should always be after `/docs/<versionName>/foo`.
249
+ */
250
+ routePriority: number | undefined;
251
+ };
252
+
253
+ export type DocFrontMatter = {
254
+ /**
255
+ * The last part of the doc ID (will be refactored in the future to be the
256
+ * full ID instead)
257
+ * @see {@link DocMetadata.id}
258
+ */
259
+ id?: string;
260
+ /**
261
+ * Will override the default title collected from h1 heading.
262
+ * @see {@link DocMetadata.title}
263
+ */
264
+ title?: string;
265
+ /**
266
+ * Front matter tags, unnormalized.
267
+ * @see {@link DocMetadata.tags}
268
+ */
269
+ tags?: FrontMatterTag[];
270
+ /**
271
+ * If there isn't a Markdown h1 heading (which, if there is, we don't
272
+ * remove), this front matter will cause the front matter title to not be
273
+ * displayed in the doc page.
274
+ */
275
+ hide_title?: boolean;
276
+ /** Hide the TOC on the right. */
277
+ hide_table_of_contents?: boolean;
278
+ /** Used in the head meta. */
279
+ keywords?: string[];
280
+ /** Used in the head meta. Should use `assets.image` in priority. */
281
+ image?: string;
282
+ /**
283
+ * Will override the default excerpt.
284
+ * @see {@link DocMetadata.description}
285
+ */
286
+ description?: string;
287
+ /**
288
+ * Custom slug appended after /<baseUrl>/<routeBasePath>/<versionPath>
289
+ * @see {@link DocMetadata.slug}
290
+ */
291
+ slug?: string;
292
+ /** Customizes the sidebar label for this doc. Will default to its title. */
293
+ sidebar_label?: string;
294
+ /**
295
+ * Controls the position of a doc inside the generated sidebar slice when
296
+ * using autogenerated sidebar items.
297
+ *
298
+ * @see https://docusaurus.io/docs/sidebar#autogenerated-sidebar-metadata
299
+ */
300
+ sidebar_position?: number;
301
+ /**
302
+ * Gives the corresponding sidebar label a special class name when using
303
+ * autogenerated sidebars.
304
+ */
305
+ sidebar_class_name?: string;
306
+ /**
307
+ * Will be propagated to the final sidebars data structure. Useful if you
308
+ * have swizzled sidebar-related code or simply querying doc data through
309
+ * sidebars.
310
+ */
311
+ sidebar_custom_props?: {[key: string]: unknown};
312
+ /**
313
+ * Changes the sidebar association of the current doc. Use `null` to make
314
+ * the current doc not associated to any sidebar.
315
+ */
316
+ displayed_sidebar?: string | null;
317
+ /**
318
+ * Customizes the pagination label for this doc. Will default to the sidebar
319
+ * label.
320
+ */
321
+ pagination_label?: string;
322
+ /** Overrides the default URL computed for this doc. */
323
+ custom_edit_url?: string | null;
324
+ /**
325
+ * Whether number prefix parsing is disabled on this doc.
326
+ * @see https://docusaurus.io/docs/sidebar#using-number-prefixes
327
+ */
328
+ parse_number_prefixes?: boolean;
329
+ /**
330
+ * Minimum TOC heading level. Must be between 2 and 6 and lower or equal to
331
+ * the max value.
332
+ */
333
+ toc_min_heading_level?: number;
334
+ /** Maximum TOC heading level. Must be between 2 and 6. */
335
+ toc_max_heading_level?: number;
336
+ /**
337
+ * The ID of the documentation you want the "Next" pagination to link to.
338
+ * Use `null` to disable showing "Next" for this page.
339
+ * @see {@link DocMetadata.next}
340
+ */
341
+ pagination_next?: string | null;
342
+ /**
343
+ * The ID of the documentation you want the "Previous" pagination to link
344
+ * to. Use `null` to disable showing "Previous" for this page.
345
+ * @see {@link DocMetadata.prev}
346
+ */
347
+ pagination_prev?: string | null;
348
+ };
349
+
350
+ export type LastUpdateData = {
351
+ /** A timestamp in **seconds**, directly acquired from `git log`. */
352
+ lastUpdatedAt?: number;
353
+ /** `lastUpdatedAt` formatted as a date according to the current locale. */
354
+ formattedLastUpdatedAt?: string;
355
+ /** The author's name directly acquired from `git log`. */
356
+ lastUpdatedBy?: string;
357
+ };
358
+
359
+ export type DocMetadataBase = LastUpdateData & {
360
+ // TODO
361
+ /**
362
+ * Legacy versioned ID. Will be refactored in the future to be unversioned.
363
+ */
364
+ id: string;
365
+ // TODO
366
+ /**
367
+ * Unversioned ID. Should be preferred everywhere over `id` until the latter
368
+ * is refactored.
369
+ */
370
+ unversionedId: string;
371
+ /** The name of the version this doc belongs to. */
372
+ version: string;
373
+ /**
374
+ * Used to generate the page h1 heading, tab title, and pagination title.
375
+ */
376
+ title: string;
377
+ /**
378
+ * Description used in the meta. Could be an empty string (empty content)
379
+ */
380
+ description: string;
381
+ /** Path to the Markdown source, with `@site` alias. */
382
+ source: string;
383
+ /**
384
+ * Posix path relative to the content path. Can be `"."`.
385
+ * e.g. "folder/subfolder/subsubfolder"
386
+ */
387
+ sourceDirName: string;
388
+ /** `permalink` without base URL or version path. */
389
+ slug: string;
390
+ /** Full URL to this doc, with base URL and version path. */
391
+ permalink: string;
392
+ /**
393
+ * Position in an autogenerated sidebar slice, acquired through front matter
394
+ * or number prefix.
395
+ */
396
+ sidebarPosition?: number;
397
+ /**
398
+ * Acquired from the options; can be customized with front matter.
399
+ * `custom_edit_url` will always lead to it being null, but you should treat
400
+ * `undefined` and `null` as equivalent.
401
+ */
402
+ editUrl?: string | null;
403
+ /** Tags, normalized. */
404
+ tags: Tag[];
405
+ /** Front matter, as-is. */
406
+ frontMatter: DocFrontMatter & {[key: string]: unknown};
407
+ };
408
+
409
+ export type DocMetadata = DocMetadataBase &
410
+ PropNavigation & {
411
+ /** Name of the sidebar this doc is associated with. */
412
+ sidebar?: string;
413
+ };
414
+
415
+ export type CategoryGeneratedIndexMetadata = Required<
416
+ Omit<
417
+ import('./sidebars/types').SidebarItemCategoryLinkGeneratedIndex,
418
+ 'type'
419
+ >,
420
+ 'title'
421
+ > & {
422
+ navigation: PropNavigation;
423
+ /**
424
+ * Name of the sidebar this doc is associated with. Unlike
425
+ * `DocMetadata.sidebar`, this will always be defined, because a generated
426
+ * index can only be generated from a category.
427
+ */
428
+ sidebar: string;
429
+ };
430
+
101
431
  export type PropNavigationLink = {
102
432
  readonly title: string;
103
433
  readonly permalink: string;
104
434
  };
105
435
  export type PropNavigation = {
436
+ /**
437
+ * Used in pagination. Content is just a subset of another doc's metadata.
438
+ */
106
439
  readonly previous?: PropNavigationLink;
440
+ /**
441
+ * Used in pagination. Content is just a subset of another doc's metadata.
442
+ */
107
443
  readonly next?: PropNavigationLink;
108
444
  };
109
445
 
110
- export type PropVersionDoc = import('./sidebars/types').PropVersionDoc;
111
- export type PropVersionDocs = import('./sidebars/types').PropVersionDocs;
446
+ export type PropVersionDoc = Pick<
447
+ DocMetadata,
448
+ 'id' | 'title' | 'description' | 'sidebar'
449
+ >;
112
450
 
113
- export type PropVersionMetadata = {
451
+ export type PropVersionDocs = {
452
+ [docId: string]: PropVersionDoc;
453
+ };
454
+
455
+ export type PropVersionMetadata = Pick<
456
+ VersionMetadata,
457
+ 'label' | 'banner' | 'badge' | 'className' | 'isLast'
458
+ > & {
459
+ /** ID of the docs plugin this version belongs to. */
114
460
  pluginId: string;
461
+ /** Name of this version. */
115
462
  version: string;
116
- label: string;
117
- banner: VersionBanner | null;
118
- badge: boolean;
119
- className: string;
120
- isLast: boolean;
463
+ /** Sidebars contained in this version. */
121
464
  docsSidebars: PropSidebars;
465
+ /** Docs contained in this version. */
122
466
  docs: PropVersionDocs;
123
467
  };
124
468
 
125
- export type PropCategoryGeneratedIndex = {
126
- title: string;
127
- description?: string;
128
- image?: string;
129
- keywords?: string | readonly string[];
130
- slug: string;
131
- permalink: string;
132
- navigation: PropNavigation;
133
- };
469
+ export type PropCategoryGeneratedIndex = Omit<
470
+ CategoryGeneratedIndexMetadata,
471
+ 'sidebar'
472
+ >;
134
473
 
135
474
  export type PropSidebarItemLink =
136
475
  import('./sidebars/types').PropSidebarItemLink;
@@ -169,9 +508,10 @@ declare module '@docusaurus/plugin-content-docs' {
169
508
  declare module '@theme/DocItem' {
170
509
  import type {TOCItem} from '@docusaurus/types';
171
510
  import type {
172
- PropNavigationLink,
173
511
  PropVersionMetadata,
174
512
  Assets,
513
+ DocMetadata,
514
+ DocFrontMatter,
175
515
  } from '@docusaurus/plugin-content-docs';
176
516
 
177
517
  export type DocumentRoute = {
@@ -181,41 +521,12 @@ declare module '@theme/DocItem' {
181
521
  readonly sidebar?: string;
182
522
  };
183
523
 
184
- export type FrontMatter = {
185
- readonly id: string;
186
- readonly title: string;
187
- readonly image?: string;
188
- readonly keywords?: readonly string[];
189
- readonly hide_title?: boolean;
190
- readonly hide_table_of_contents?: boolean;
191
- readonly toc_min_heading_level?: number;
192
- readonly toc_max_heading_level?: number;
193
- };
194
-
195
- export type Metadata = {
196
- readonly unversionedId?: string;
197
- readonly description?: string;
198
- readonly title?: string;
199
- readonly permalink?: string;
200
- readonly editUrl?: string;
201
- readonly lastUpdatedAt?: number;
202
- readonly formattedLastUpdatedAt?: string;
203
- readonly lastUpdatedBy?: string;
204
- readonly version?: string;
205
- readonly previous?: PropNavigationLink;
206
- readonly next?: PropNavigationLink;
207
- readonly tags: readonly {
208
- readonly label: string;
209
- readonly permalink: string;
210
- }[];
211
- };
212
-
213
524
  export interface Props {
214
525
  readonly route: DocumentRoute;
215
526
  readonly versionMetadata: PropVersionMetadata;
216
527
  readonly content: {
217
- readonly frontMatter: FrontMatter;
218
- readonly metadata: Metadata;
528
+ readonly frontMatter: DocFrontMatter;
529
+ readonly metadata: DocMetadata;
219
530
  readonly toc: readonly TOCItem[];
220
531
  readonly contentTitle: string | undefined;
221
532
  readonly assets: Assets;
package/src/props.ts CHANGED
@@ -5,13 +5,12 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
 
8
- import type {LoadedVersion, VersionTag, DocMetadata} from './types';
8
+ import type {LoadedVersion, VersionTag} from './types';
9
9
  import type {
10
10
  SidebarItemDoc,
11
11
  SidebarItem,
12
12
  SidebarItemCategory,
13
13
  SidebarItemCategoryLink,
14
- PropVersionDocs,
15
14
  } from './sidebars/types';
16
15
  import type {
17
16
  PropSidebars,
@@ -21,6 +20,8 @@ import type {
21
20
  PropTagDocList,
22
21
  PropTagDocListDoc,
23
22
  PropSidebarItemLink,
23
+ PropVersionDocs,
24
+ DocMetadata,
24
25
  } from '@docusaurus/plugin-content-docs';
25
26
  import _ from 'lodash';
26
27
  import {createDocsByIdIndex} from './docs';
@@ -119,10 +120,10 @@ export function toVersionMetadataProp(
119
120
  return {
120
121
  pluginId,
121
122
  version: loadedVersion.versionName,
122
- label: loadedVersion.versionLabel,
123
- banner: loadedVersion.versionBanner,
124
- badge: loadedVersion.versionBadge,
125
- className: loadedVersion.versionClassName,
123
+ label: loadedVersion.label,
124
+ banner: loadedVersion.banner,
125
+ badge: loadedVersion.badge,
126
+ className: loadedVersion.className,
126
127
  isLast: loadedVersion.isLast,
127
128
  docsSidebars: toSidebarsProp(loadedVersion),
128
129
  docs: toVersionDocsProp(loadedVersion),
@@ -153,7 +154,7 @@ export function toTagDocListProp({
153
154
  }
154
155
 
155
156
  return {
156
- name: tag.name,
157
+ name: tag.label,
157
158
  permalink: tag.permalink,
158
159
  docs: toDocListProp(),
159
160
  allTagsPath,
package/src/routes.ts CHANGED
@@ -7,12 +7,11 @@
7
7
 
8
8
  import type {PluginContentLoadedActions, RouteConfig} from '@docusaurus/types';
9
9
  import {docuHash, createSlugger} from '@docusaurus/utils';
10
+ import type {LoadedVersion} from './types';
10
11
  import type {
11
12
  CategoryGeneratedIndexMetadata,
12
13
  DocMetadata,
13
- LoadedVersion,
14
- } from './types';
15
- import type {PropCategoryGeneratedIndex} from '@docusaurus/plugin-content-docs';
14
+ } from '@docusaurus/plugin-content-docs';
16
15
  import {toVersionMetadataProp} from './props';
17
16
  import logger from '@docusaurus/logger';
18
17
 
@@ -32,42 +31,19 @@ export async function createCategoryGeneratedIndexRoutes({
32
31
  async function createCategoryGeneratedIndexRoute(
33
32
  categoryGeneratedIndex: CategoryGeneratedIndexMetadata,
34
33
  ): Promise<RouteConfig> {
35
- const {
36
- sidebar,
37
- title,
38
- description,
39
- slug,
40
- permalink,
41
- previous,
42
- next,
43
- image,
44
- keywords,
45
- } = categoryGeneratedIndex;
34
+ const {sidebar, ...prop} = categoryGeneratedIndex;
46
35
 
47
36
  const propFileName = slugs.slug(
48
- `${version.versionPath}-${categoryGeneratedIndex.sidebar}-category-${categoryGeneratedIndex.title}`,
37
+ `${version.path}-${categoryGeneratedIndex.sidebar}-category-${categoryGeneratedIndex.title}`,
49
38
  );
50
39
 
51
- const prop: PropCategoryGeneratedIndex = {
52
- title,
53
- description,
54
- slug,
55
- permalink,
56
- image,
57
- keywords,
58
- navigation: {
59
- previous,
60
- next,
61
- },
62
- };
63
-
64
40
  const propData = await actions.createData(
65
41
  `${docuHash(`category/${propFileName}`)}.json`,
66
42
  JSON.stringify(prop, null, 2),
67
43
  );
68
44
 
69
45
  return {
70
- path: permalink,
46
+ path: categoryGeneratedIndex.permalink,
71
47
  component: docCategoryGeneratedIndexComponent,
72
48
  exact: true,
73
49
  modules: {
@@ -162,7 +138,7 @@ export async function createVersionRoutes({
162
138
  }
163
139
 
164
140
  actions.addRoute({
165
- path: version.versionPath,
141
+ path: version.path,
166
142
  // allow matching /docs/* as well
167
143
  exact: false,
168
144
  // main docs component (DocPage)
@@ -65,7 +65,7 @@ function normalizeSidebar(
65
65
  throw new Error(
66
66
  logger.interpolate`Invalid sidebar items collection code=${JSON.stringify(
67
67
  sidebar,
68
- )} in ${place}: it must either be an array of sidebar items or a shorthand notation (which doesn't contain a code=${'type'} property). See path=${'https://docusaurus.io/docs/sidebar/items'} for all valid syntaxes.`,
68
+ )} in ${place}: it must either be an array of sidebar items or a shorthand notation (which doesn't contain a code=${'type'} property). See url=${'https://docusaurus.io/docs/sidebar/items'} for all valid syntaxes.`,
69
69
  );
70
70
  }
71
71
 
@@ -26,7 +26,7 @@ function normalizeCategoryLink(
26
26
  const getDefaultSlug = () =>
27
27
  `/category/${params.categoryLabelSlugger.slug(category.label)}`;
28
28
  const slug = category.link.slug ?? getDefaultSlug();
29
- const permalink = normalizeUrl([params.version.versionPath, slug]);
29
+ const permalink = normalizeUrl([params.version.path, slug]);
30
30
  return {
31
31
  ...category.link,
32
32
  slug,