@docusaurus/plugin-content-docs 0.0.0-4246 → 0.0.0-4251
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.
- package/lib/.tsbuildinfo +1 -1
- package/lib/docs.js +8 -17
- package/lib/options.js +3 -7
- package/lib/types.d.ts +0 -2
- package/package.json +15 -15
- package/src/__tests__/__fixtures__/simple-site/docs/hello.md +1 -0
- package/src/__tests__/__fixtures__/site-with-doc-label/docs/hello-1.md +1 -0
- package/src/__tests__/__fixtures__/versioned-site/docs/hello.md +3 -0
- package/src/__tests__/__fixtures__/versioned-site/i18n/en/docusaurus-plugin-content-docs/version-1.0.0/hello.md +3 -0
- package/src/__tests__/__fixtures__/versioned-site/i18n/fr/docusaurus-plugin-content-docs/version-1.0.0/hello.md +3 -0
- package/src/__tests__/__fixtures__/versioned-site/versioned_docs/version-1.0.0/hello.md +3 -0
- package/src/__tests__/__fixtures__/versioned-site/versioned_docs/version-1.0.1/hello.md +3 -0
- package/src/__tests__/__snapshots__/docs.test.ts.snap +2 -2
- package/src/__tests__/__snapshots__/index.test.ts.snap +11 -39
- package/src/__tests__/__snapshots__/translations.test.ts.snap +0 -15
- package/src/__tests__/docs.test.ts +42 -141
- package/src/__tests__/index.test.ts +7 -33
- package/src/__tests__/options.test.ts +0 -1
- package/src/__tests__/translations.test.ts +0 -1
- package/src/docs.ts +8 -20
- package/src/options.ts +5 -12
- package/src/types.ts +0 -2
|
@@ -220,7 +220,6 @@ describe('simple site', () => {
|
|
|
220
220
|
id: 'foo/bar',
|
|
221
221
|
unversionedId: 'foo/bar',
|
|
222
222
|
sourceDirName: 'foo',
|
|
223
|
-
isDocsHomePage: false,
|
|
224
223
|
permalink: '/docs/foo/bar',
|
|
225
224
|
slug: '/foo/bar',
|
|
226
225
|
title: 'Bar',
|
|
@@ -237,48 +236,6 @@ describe('simple site', () => {
|
|
|
237
236
|
id: 'hello',
|
|
238
237
|
unversionedId: 'hello',
|
|
239
238
|
sourceDirName: '.',
|
|
240
|
-
isDocsHomePage: false,
|
|
241
|
-
permalink: '/docs/hello',
|
|
242
|
-
slug: '/hello',
|
|
243
|
-
title: 'Hello, World !',
|
|
244
|
-
description: `Hi, Endilie here :)`,
|
|
245
|
-
frontMatter: {
|
|
246
|
-
id: 'hello',
|
|
247
|
-
title: 'Hello, World !',
|
|
248
|
-
sidebar_label: 'Hello sidebar_label',
|
|
249
|
-
tags: ['tag-1', 'tag 3'],
|
|
250
|
-
},
|
|
251
|
-
tags: [
|
|
252
|
-
{
|
|
253
|
-
label: 'tag-1',
|
|
254
|
-
permalink: '/docs/tags/tag-1',
|
|
255
|
-
},
|
|
256
|
-
{
|
|
257
|
-
label: 'tag 3',
|
|
258
|
-
permalink: '/docs/tags/tag-3',
|
|
259
|
-
},
|
|
260
|
-
],
|
|
261
|
-
});
|
|
262
|
-
});
|
|
263
|
-
|
|
264
|
-
test('homePageId doc', async () => {
|
|
265
|
-
const {siteDir, context, options, currentVersion} = await loadSite({
|
|
266
|
-
options: {homePageId: 'hello'},
|
|
267
|
-
});
|
|
268
|
-
|
|
269
|
-
const testUtilsLocal = createTestUtils({
|
|
270
|
-
siteDir,
|
|
271
|
-
context,
|
|
272
|
-
options,
|
|
273
|
-
versionMetadata: currentVersion,
|
|
274
|
-
});
|
|
275
|
-
|
|
276
|
-
await testUtilsLocal.testMeta(path.join('hello.md'), {
|
|
277
|
-
version: 'current',
|
|
278
|
-
id: 'hello',
|
|
279
|
-
unversionedId: 'hello',
|
|
280
|
-
sourceDirName: '.',
|
|
281
|
-
isDocsHomePage: true,
|
|
282
239
|
permalink: '/docs/',
|
|
283
240
|
slug: '/',
|
|
284
241
|
title: 'Hello, World !',
|
|
@@ -287,6 +244,7 @@ describe('simple site', () => {
|
|
|
287
244
|
id: 'hello',
|
|
288
245
|
title: 'Hello, World !',
|
|
289
246
|
sidebar_label: 'Hello sidebar_label',
|
|
247
|
+
slug: '/',
|
|
290
248
|
tags: ['tag-1', 'tag 3'],
|
|
291
249
|
},
|
|
292
250
|
tags: [
|
|
@@ -302,37 +260,6 @@ describe('simple site', () => {
|
|
|
302
260
|
});
|
|
303
261
|
});
|
|
304
262
|
|
|
305
|
-
test('homePageId doc nested', async () => {
|
|
306
|
-
const {siteDir, context, options, currentVersion} = await loadSite({
|
|
307
|
-
options: {homePageId: 'foo/bar'},
|
|
308
|
-
});
|
|
309
|
-
|
|
310
|
-
const testUtilsLocal = createTestUtils({
|
|
311
|
-
siteDir,
|
|
312
|
-
context,
|
|
313
|
-
options,
|
|
314
|
-
versionMetadata: currentVersion,
|
|
315
|
-
});
|
|
316
|
-
|
|
317
|
-
await testUtilsLocal.testMeta(path.join('foo', 'bar.md'), {
|
|
318
|
-
version: 'current',
|
|
319
|
-
id: 'foo/bar',
|
|
320
|
-
unversionedId: 'foo/bar',
|
|
321
|
-
sourceDirName: 'foo',
|
|
322
|
-
isDocsHomePage: true,
|
|
323
|
-
permalink: '/docs/',
|
|
324
|
-
slug: '/',
|
|
325
|
-
title: 'Bar',
|
|
326
|
-
description: 'This is custom description',
|
|
327
|
-
frontMatter: {
|
|
328
|
-
description: 'This is custom description',
|
|
329
|
-
id: 'bar',
|
|
330
|
-
title: 'Bar',
|
|
331
|
-
},
|
|
332
|
-
tags: [],
|
|
333
|
-
});
|
|
334
|
-
});
|
|
335
|
-
|
|
336
263
|
test('docs with editUrl', async () => {
|
|
337
264
|
const {siteDir, context, options, currentVersion} = await loadSite({
|
|
338
265
|
options: {
|
|
@@ -352,7 +279,6 @@ describe('simple site', () => {
|
|
|
352
279
|
id: 'foo/baz',
|
|
353
280
|
unversionedId: 'foo/baz',
|
|
354
281
|
sourceDirName: 'foo',
|
|
355
|
-
isDocsHomePage: false,
|
|
356
282
|
permalink: '/docs/foo/bazSlug.html',
|
|
357
283
|
slug: '/foo/bazSlug.html',
|
|
358
284
|
title: 'baz',
|
|
@@ -391,7 +317,6 @@ describe('simple site', () => {
|
|
|
391
317
|
id: 'lorem',
|
|
392
318
|
unversionedId: 'lorem',
|
|
393
319
|
sourceDirName: '.',
|
|
394
|
-
isDocsHomePage: false,
|
|
395
320
|
permalink: '/docs/lorem',
|
|
396
321
|
slug: '/lorem',
|
|
397
322
|
title: 'lorem',
|
|
@@ -428,7 +353,6 @@ describe('simple site', () => {
|
|
|
428
353
|
id: 'foo/baz',
|
|
429
354
|
unversionedId: 'foo/baz',
|
|
430
355
|
sourceDirName: 'foo',
|
|
431
|
-
isDocsHomePage: false,
|
|
432
356
|
permalink: '/docs/foo/bazSlug.html',
|
|
433
357
|
slug: '/foo/bazSlug.html',
|
|
434
358
|
title: 'baz',
|
|
@@ -487,7 +411,6 @@ describe('simple site', () => {
|
|
|
487
411
|
id: 'lorem',
|
|
488
412
|
unversionedId: 'lorem',
|
|
489
413
|
sourceDirName: '.',
|
|
490
|
-
isDocsHomePage: false,
|
|
491
414
|
permalink: '/docs/lorem',
|
|
492
415
|
slug: '/lorem',
|
|
493
416
|
title: 'lorem',
|
|
@@ -558,33 +481,6 @@ describe('simple site', () => {
|
|
|
558
481
|
);
|
|
559
482
|
});
|
|
560
483
|
|
|
561
|
-
test('docs with slug on doc home', async () => {
|
|
562
|
-
const {siteDir, context, options, currentVersion} = await loadSite({
|
|
563
|
-
options: {
|
|
564
|
-
homePageId: 'homePageId',
|
|
565
|
-
},
|
|
566
|
-
});
|
|
567
|
-
|
|
568
|
-
const testUtilsLocal = createTestUtils({
|
|
569
|
-
siteDir,
|
|
570
|
-
context,
|
|
571
|
-
options,
|
|
572
|
-
versionMetadata: currentVersion,
|
|
573
|
-
});
|
|
574
|
-
expect(() => {
|
|
575
|
-
testUtilsLocal.processDocFile(
|
|
576
|
-
createFakeDocFile({
|
|
577
|
-
source: 'homePageId',
|
|
578
|
-
frontmatter: {
|
|
579
|
-
slug: '/x/y',
|
|
580
|
-
},
|
|
581
|
-
}),
|
|
582
|
-
);
|
|
583
|
-
}).toThrowErrorMatchingInlineSnapshot(
|
|
584
|
-
`"The docs homepage (homePageId=homePageId) is not allowed to have a frontmatter slug=/x/y => you have to choose either homePageId or slug, not both"`,
|
|
585
|
-
);
|
|
586
|
-
});
|
|
587
|
-
|
|
588
484
|
test('custom pagination', async () => {
|
|
589
485
|
const {defaultTestUtils, options, versionsMetadata} = await loadSite();
|
|
590
486
|
const docs = await readVersionDocs(versionsMetadata[0], options);
|
|
@@ -679,7 +575,6 @@ describe('versioned site', () => {
|
|
|
679
575
|
version: 'current',
|
|
680
576
|
unversionedId: 'foo/bar',
|
|
681
577
|
sourceDirName: 'foo',
|
|
682
|
-
isDocsHomePage: false,
|
|
683
578
|
permalink: '/docs/next/foo/barSlug',
|
|
684
579
|
slug: '/foo/barSlug',
|
|
685
580
|
title: 'bar',
|
|
@@ -715,12 +610,13 @@ describe('versioned site', () => {
|
|
|
715
610
|
version: 'current',
|
|
716
611
|
unversionedId: 'hello',
|
|
717
612
|
sourceDirName: '.',
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
slug: '/hello',
|
|
613
|
+
permalink: '/docs/next/',
|
|
614
|
+
slug: '/',
|
|
721
615
|
title: 'hello',
|
|
722
616
|
description: 'Hello next !',
|
|
723
|
-
frontMatter: {
|
|
617
|
+
frontMatter: {
|
|
618
|
+
slug: '/',
|
|
619
|
+
},
|
|
724
620
|
tags: [],
|
|
725
621
|
});
|
|
726
622
|
});
|
|
@@ -732,7 +628,6 @@ describe('versioned site', () => {
|
|
|
732
628
|
id: 'version-1.0.0/foo/bar',
|
|
733
629
|
unversionedId: 'foo/bar',
|
|
734
630
|
sourceDirName: 'foo',
|
|
735
|
-
isDocsHomePage: false,
|
|
736
631
|
permalink: '/docs/1.0.0/foo/barSlug',
|
|
737
632
|
slug: '/foo/barSlug',
|
|
738
633
|
title: 'bar',
|
|
@@ -745,12 +640,13 @@ describe('versioned site', () => {
|
|
|
745
640
|
id: 'version-1.0.0/hello',
|
|
746
641
|
unversionedId: 'hello',
|
|
747
642
|
sourceDirName: '.',
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
slug: '/hello',
|
|
643
|
+
permalink: '/docs/1.0.0/',
|
|
644
|
+
slug: '/',
|
|
751
645
|
title: 'hello',
|
|
752
646
|
description: 'Hello 1.0.0 ! (translated en)',
|
|
753
|
-
frontMatter: {
|
|
647
|
+
frontMatter: {
|
|
648
|
+
slug: '/',
|
|
649
|
+
},
|
|
754
650
|
version: '1.0.0',
|
|
755
651
|
source:
|
|
756
652
|
'@site/i18n/en/docusaurus-plugin-content-docs/version-1.0.0/hello.md',
|
|
@@ -760,7 +656,6 @@ describe('versioned site', () => {
|
|
|
760
656
|
id: 'version-1.0.1/foo/bar',
|
|
761
657
|
unversionedId: 'foo/bar',
|
|
762
658
|
sourceDirName: 'foo',
|
|
763
|
-
isDocsHomePage: false,
|
|
764
659
|
permalink: '/docs/foo/bar',
|
|
765
660
|
slug: '/foo/bar',
|
|
766
661
|
title: 'bar',
|
|
@@ -773,13 +668,14 @@ describe('versioned site', () => {
|
|
|
773
668
|
id: 'version-1.0.1/hello',
|
|
774
669
|
unversionedId: 'hello',
|
|
775
670
|
sourceDirName: '.',
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
slug: '/hello',
|
|
671
|
+
permalink: '/docs/',
|
|
672
|
+
slug: '/',
|
|
779
673
|
title: 'hello',
|
|
780
674
|
description: 'Hello 1.0.1 !',
|
|
781
675
|
version: '1.0.1',
|
|
782
|
-
frontMatter: {
|
|
676
|
+
frontMatter: {
|
|
677
|
+
slug: '/',
|
|
678
|
+
},
|
|
783
679
|
tags: [],
|
|
784
680
|
});
|
|
785
681
|
});
|
|
@@ -865,12 +761,13 @@ describe('versioned site', () => {
|
|
|
865
761
|
id: 'version-1.0.0/hello',
|
|
866
762
|
unversionedId: 'hello',
|
|
867
763
|
sourceDirName: '.',
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
slug: '/hello',
|
|
764
|
+
permalink: '/docs/1.0.0/',
|
|
765
|
+
slug: '/',
|
|
871
766
|
title: 'hello',
|
|
872
767
|
description: 'Hello 1.0.0 ! (translated en)',
|
|
873
|
-
frontMatter: {
|
|
768
|
+
frontMatter: {
|
|
769
|
+
slug: '/',
|
|
770
|
+
},
|
|
874
771
|
version: '1.0.0',
|
|
875
772
|
source:
|
|
876
773
|
'@site/i18n/en/docusaurus-plugin-content-docs/version-1.0.0/hello.md',
|
|
@@ -883,7 +780,7 @@ describe('versioned site', () => {
|
|
|
883
780
|
version: '1.0.0',
|
|
884
781
|
versionDocsDirPath: 'versioned_docs/version-1.0.0',
|
|
885
782
|
docPath: path.join('hello.md'),
|
|
886
|
-
permalink: '/docs/1.0.0/
|
|
783
|
+
permalink: '/docs/1.0.0/',
|
|
887
784
|
locale: 'en',
|
|
888
785
|
});
|
|
889
786
|
});
|
|
@@ -907,12 +804,13 @@ describe('versioned site', () => {
|
|
|
907
804
|
id: 'version-1.0.0/hello',
|
|
908
805
|
unversionedId: 'hello',
|
|
909
806
|
sourceDirName: '.',
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
slug: '/hello',
|
|
807
|
+
permalink: '/docs/1.0.0/',
|
|
808
|
+
slug: '/',
|
|
913
809
|
title: 'hello',
|
|
914
810
|
description: 'Hello 1.0.0 ! (translated en)',
|
|
915
|
-
frontMatter: {
|
|
811
|
+
frontMatter: {
|
|
812
|
+
slug: '/',
|
|
813
|
+
},
|
|
916
814
|
version: '1.0.0',
|
|
917
815
|
source:
|
|
918
816
|
'@site/i18n/en/docusaurus-plugin-content-docs/version-1.0.0/hello.md',
|
|
@@ -941,12 +839,13 @@ describe('versioned site', () => {
|
|
|
941
839
|
id: 'version-1.0.0/hello',
|
|
942
840
|
unversionedId: 'hello',
|
|
943
841
|
sourceDirName: '.',
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
slug: '/hello',
|
|
842
|
+
permalink: '/docs/1.0.0/',
|
|
843
|
+
slug: '/',
|
|
947
844
|
title: 'hello',
|
|
948
845
|
description: 'Hello 1.0.0 ! (translated en)',
|
|
949
|
-
frontMatter: {
|
|
846
|
+
frontMatter: {
|
|
847
|
+
slug: '/',
|
|
848
|
+
},
|
|
950
849
|
version: '1.0.0',
|
|
951
850
|
source:
|
|
952
851
|
'@site/i18n/en/docusaurus-plugin-content-docs/version-1.0.0/hello.md',
|
|
@@ -976,12 +875,13 @@ describe('versioned site', () => {
|
|
|
976
875
|
id: 'version-1.0.0/hello',
|
|
977
876
|
unversionedId: 'hello',
|
|
978
877
|
sourceDirName: '.',
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
slug: '/hello',
|
|
878
|
+
permalink: '/fr/docs/1.0.0/',
|
|
879
|
+
slug: '/',
|
|
982
880
|
title: 'hello',
|
|
983
881
|
description: 'Hello 1.0.0 ! (translated fr)',
|
|
984
|
-
frontMatter: {
|
|
882
|
+
frontMatter: {
|
|
883
|
+
slug: '/',
|
|
884
|
+
},
|
|
985
885
|
version: '1.0.0',
|
|
986
886
|
source:
|
|
987
887
|
'@site/i18n/fr/docusaurus-plugin-content-docs/version-1.0.0/hello.md',
|
|
@@ -1012,12 +912,13 @@ describe('versioned site', () => {
|
|
|
1012
912
|
id: 'version-1.0.0/hello',
|
|
1013
913
|
unversionedId: 'hello',
|
|
1014
914
|
sourceDirName: '.',
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
slug: '/hello',
|
|
915
|
+
permalink: '/fr/docs/1.0.0/',
|
|
916
|
+
slug: '/',
|
|
1018
917
|
title: 'hello',
|
|
1019
918
|
description: 'Hello 1.0.0 ! (translated fr)',
|
|
1020
|
-
frontMatter: {
|
|
919
|
+
frontMatter: {
|
|
920
|
+
slug: '/',
|
|
921
|
+
},
|
|
1021
922
|
version: '1.0.0',
|
|
1022
923
|
source:
|
|
1023
924
|
'@site/i18n/fr/docusaurus-plugin-content-docs/version-1.0.0/hello.md',
|
|
@@ -247,7 +247,6 @@ describe('simple website', () => {
|
|
|
247
247
|
normalizePluginOptions(OptionsSchema, {
|
|
248
248
|
path: 'docs',
|
|
249
249
|
sidebarPath,
|
|
250
|
-
homePageId: 'hello',
|
|
251
250
|
}),
|
|
252
251
|
);
|
|
253
252
|
const pluginContentDir = path.join(context.generatedFilesDir, plugin.name);
|
|
@@ -337,7 +336,6 @@ describe('simple website', () => {
|
|
|
337
336
|
id: 'foo/baz',
|
|
338
337
|
unversionedId: 'foo/baz',
|
|
339
338
|
sourceDirName: 'foo',
|
|
340
|
-
isDocsHomePage: false,
|
|
341
339
|
permalink: '/docs/foo/bazSlug.html',
|
|
342
340
|
slug: '/foo/bazSlug.html',
|
|
343
341
|
previous: {
|
|
@@ -388,7 +386,6 @@ describe('simple website', () => {
|
|
|
388
386
|
id: 'hello',
|
|
389
387
|
unversionedId: 'hello',
|
|
390
388
|
sourceDirName: '.',
|
|
391
|
-
isDocsHomePage: true,
|
|
392
389
|
permalink: '/docs/',
|
|
393
390
|
slug: '/',
|
|
394
391
|
previous: {
|
|
@@ -407,6 +404,7 @@ describe('simple website', () => {
|
|
|
407
404
|
id: 'hello',
|
|
408
405
|
title: 'Hello, World !',
|
|
409
406
|
sidebar_label: 'Hello sidebar_label',
|
|
407
|
+
slug: '/',
|
|
410
408
|
tags: ['tag-1', 'tag 3'],
|
|
411
409
|
},
|
|
412
410
|
tags: [
|
|
@@ -427,7 +425,6 @@ describe('simple website', () => {
|
|
|
427
425
|
id: 'foo/bar',
|
|
428
426
|
unversionedId: 'foo/bar',
|
|
429
427
|
sourceDirName: 'foo',
|
|
430
|
-
isDocsHomePage: false,
|
|
431
428
|
next: {
|
|
432
429
|
title: 'baz pagination_label',
|
|
433
430
|
permalink: '/docs/foo/bazSlug.html',
|
|
@@ -479,7 +476,6 @@ describe('versioned website', () => {
|
|
|
479
476
|
normalizePluginOptions(OptionsSchema, {
|
|
480
477
|
routeBasePath,
|
|
481
478
|
sidebarPath,
|
|
482
|
-
homePageId: 'hello',
|
|
483
479
|
}),
|
|
484
480
|
);
|
|
485
481
|
const pluginContentDir = path.join(context.generatedFilesDir, plugin.name);
|
|
@@ -588,7 +584,6 @@ describe('versioned website', () => {
|
|
|
588
584
|
id: 'foo/bar',
|
|
589
585
|
unversionedId: 'foo/bar',
|
|
590
586
|
sourceDirName: 'foo',
|
|
591
|
-
isDocsHomePage: false,
|
|
592
587
|
permalink: '/docs/next/foo/barSlug',
|
|
593
588
|
slug: '/foo/barSlug',
|
|
594
589
|
source: path.posix.join(
|
|
@@ -624,7 +619,6 @@ describe('versioned website', () => {
|
|
|
624
619
|
id: 'version-1.0.1/foo/bar',
|
|
625
620
|
unversionedId: 'foo/bar',
|
|
626
621
|
sourceDirName: 'foo',
|
|
627
|
-
isDocsHomePage: false,
|
|
628
622
|
permalink: '/docs/foo/bar',
|
|
629
623
|
slug: '/foo/bar',
|
|
630
624
|
source: path.posix.join(
|
|
@@ -650,7 +644,6 @@ describe('versioned website', () => {
|
|
|
650
644
|
id: 'hello',
|
|
651
645
|
unversionedId: 'hello',
|
|
652
646
|
sourceDirName: '.',
|
|
653
|
-
isDocsHomePage: true,
|
|
654
647
|
permalink: '/docs/next/',
|
|
655
648
|
slug: '/',
|
|
656
649
|
source: path.posix.join(
|
|
@@ -660,7 +653,9 @@ describe('versioned website', () => {
|
|
|
660
653
|
),
|
|
661
654
|
title: 'hello',
|
|
662
655
|
description: 'Hello next !',
|
|
663
|
-
frontMatter: {
|
|
656
|
+
frontMatter: {
|
|
657
|
+
slug: '/',
|
|
658
|
+
},
|
|
664
659
|
version: 'current',
|
|
665
660
|
sidebar: 'docs',
|
|
666
661
|
previous: {
|
|
@@ -673,7 +668,6 @@ describe('versioned website', () => {
|
|
|
673
668
|
id: 'version-1.0.1/hello',
|
|
674
669
|
unversionedId: 'hello',
|
|
675
670
|
sourceDirName: '.',
|
|
676
|
-
isDocsHomePage: true,
|
|
677
671
|
permalink: '/docs/',
|
|
678
672
|
slug: '/',
|
|
679
673
|
source: path.posix.join(
|
|
@@ -683,7 +677,9 @@ describe('versioned website', () => {
|
|
|
683
677
|
),
|
|
684
678
|
title: 'hello',
|
|
685
679
|
description: 'Hello 1.0.1 !',
|
|
686
|
-
frontMatter: {
|
|
680
|
+
frontMatter: {
|
|
681
|
+
slug: '/',
|
|
682
|
+
},
|
|
687
683
|
version: '1.0.1',
|
|
688
684
|
sidebar: 'VersionedSideBarNameDoesNotMatter/docs',
|
|
689
685
|
previous: {
|
|
@@ -696,7 +692,6 @@ describe('versioned website', () => {
|
|
|
696
692
|
id: 'version-1.0.0/foo/baz',
|
|
697
693
|
unversionedId: 'foo/baz',
|
|
698
694
|
sourceDirName: 'foo',
|
|
699
|
-
isDocsHomePage: false,
|
|
700
695
|
permalink: '/docs/1.0.0/foo/baz',
|
|
701
696
|
slug: '/foo/baz',
|
|
702
697
|
source: path.posix.join(
|
|
@@ -844,7 +839,6 @@ describe('versioned website (community)', () => {
|
|
|
844
839
|
id: 'team',
|
|
845
840
|
unversionedId: 'team',
|
|
846
841
|
sourceDirName: '.',
|
|
847
|
-
isDocsHomePage: false,
|
|
848
842
|
permalink: '/community/next/team',
|
|
849
843
|
slug: '/team',
|
|
850
844
|
source:
|
|
@@ -860,7 +854,6 @@ describe('versioned website (community)', () => {
|
|
|
860
854
|
id: 'version-1.0.0/team',
|
|
861
855
|
unversionedId: 'team',
|
|
862
856
|
sourceDirName: '.',
|
|
863
|
-
isDocsHomePage: false,
|
|
864
857
|
permalink: '/community/team',
|
|
865
858
|
slug: '/team',
|
|
866
859
|
source: path.posix.join(
|
|
@@ -902,7 +895,6 @@ describe('site with doc label', () => {
|
|
|
902
895
|
normalizePluginOptions(OptionsSchema, {
|
|
903
896
|
path: 'docs',
|
|
904
897
|
sidebarPath,
|
|
905
|
-
homePageId: 'hello-1',
|
|
906
898
|
}),
|
|
907
899
|
);
|
|
908
900
|
|
|
@@ -1056,7 +1048,6 @@ describe('site with full autogenerated sidebar', () => {
|
|
|
1056
1048
|
id: 'getting-started',
|
|
1057
1049
|
unversionedId: 'getting-started',
|
|
1058
1050
|
sourceDirName: '.',
|
|
1059
|
-
isDocsHomePage: false,
|
|
1060
1051
|
permalink: '/docs/getting-started',
|
|
1061
1052
|
slug: '/getting-started',
|
|
1062
1053
|
source: path.posix.join(
|
|
@@ -1082,7 +1073,6 @@ describe('site with full autogenerated sidebar', () => {
|
|
|
1082
1073
|
id: 'installation',
|
|
1083
1074
|
unversionedId: 'installation',
|
|
1084
1075
|
sourceDirName: '.',
|
|
1085
|
-
isDocsHomePage: false,
|
|
1086
1076
|
permalink: '/docs/installation',
|
|
1087
1077
|
slug: '/installation',
|
|
1088
1078
|
source: path.posix.join(
|
|
@@ -1111,7 +1101,6 @@ describe('site with full autogenerated sidebar', () => {
|
|
|
1111
1101
|
id: 'Guides/guide1',
|
|
1112
1102
|
unversionedId: 'Guides/guide1',
|
|
1113
1103
|
sourceDirName: 'Guides',
|
|
1114
|
-
isDocsHomePage: false,
|
|
1115
1104
|
permalink: '/docs/Guides/guide1',
|
|
1116
1105
|
slug: '/Guides/guide1',
|
|
1117
1106
|
source: path.posix.join(
|
|
@@ -1144,7 +1133,6 @@ describe('site with full autogenerated sidebar', () => {
|
|
|
1144
1133
|
id: 'Guides/guide2',
|
|
1145
1134
|
unversionedId: 'Guides/guide2',
|
|
1146
1135
|
sourceDirName: 'Guides',
|
|
1147
|
-
isDocsHomePage: false,
|
|
1148
1136
|
permalink: '/docs/Guides/guide2',
|
|
1149
1137
|
slug: '/Guides/guide2',
|
|
1150
1138
|
source: path.posix.join(
|
|
@@ -1176,7 +1164,6 @@ describe('site with full autogenerated sidebar', () => {
|
|
|
1176
1164
|
id: 'Guides/guide2.5',
|
|
1177
1165
|
unversionedId: 'Guides/guide2.5',
|
|
1178
1166
|
sourceDirName: 'Guides',
|
|
1179
|
-
isDocsHomePage: false,
|
|
1180
1167
|
permalink: '/docs/Guides/guide2.5',
|
|
1181
1168
|
slug: '/Guides/guide2.5',
|
|
1182
1169
|
source: path.posix.join(
|
|
@@ -1209,7 +1196,6 @@ describe('site with full autogenerated sidebar', () => {
|
|
|
1209
1196
|
id: 'Guides/guide3',
|
|
1210
1197
|
unversionedId: 'Guides/guide3',
|
|
1211
1198
|
sourceDirName: 'Guides',
|
|
1212
|
-
isDocsHomePage: false,
|
|
1213
1199
|
permalink: '/docs/Guides/guide3',
|
|
1214
1200
|
slug: '/Guides/guide3',
|
|
1215
1201
|
source: path.posix.join(
|
|
@@ -1242,7 +1228,6 @@ describe('site with full autogenerated sidebar', () => {
|
|
|
1242
1228
|
id: 'Guides/guide4',
|
|
1243
1229
|
unversionedId: 'Guides/guide4',
|
|
1244
1230
|
sourceDirName: 'Guides',
|
|
1245
|
-
isDocsHomePage: false,
|
|
1246
1231
|
permalink: '/docs/Guides/guide4',
|
|
1247
1232
|
slug: '/Guides/guide4',
|
|
1248
1233
|
source: path.posix.join(
|
|
@@ -1274,7 +1259,6 @@ describe('site with full autogenerated sidebar', () => {
|
|
|
1274
1259
|
id: 'Guides/guide5',
|
|
1275
1260
|
unversionedId: 'Guides/guide5',
|
|
1276
1261
|
sourceDirName: 'Guides',
|
|
1277
|
-
isDocsHomePage: false,
|
|
1278
1262
|
permalink: '/docs/Guides/guide5',
|
|
1279
1263
|
slug: '/Guides/guide5',
|
|
1280
1264
|
source: path.posix.join(
|
|
@@ -1306,7 +1290,6 @@ describe('site with full autogenerated sidebar', () => {
|
|
|
1306
1290
|
id: 'API/api-overview',
|
|
1307
1291
|
unversionedId: 'API/api-overview',
|
|
1308
1292
|
sourceDirName: '3-API',
|
|
1309
|
-
isDocsHomePage: false,
|
|
1310
1293
|
permalink: '/docs/API/api-overview',
|
|
1311
1294
|
slug: '/API/api-overview',
|
|
1312
1295
|
source: path.posix.join(
|
|
@@ -1336,7 +1319,6 @@ describe('site with full autogenerated sidebar', () => {
|
|
|
1336
1319
|
id: 'API/Core APIs/Client API',
|
|
1337
1320
|
unversionedId: 'API/Core APIs/Client API',
|
|
1338
1321
|
sourceDirName: '3-API/01_Core APIs',
|
|
1339
|
-
isDocsHomePage: false,
|
|
1340
1322
|
permalink: '/docs/API/Core APIs/Client API',
|
|
1341
1323
|
slug: '/API/Core APIs/Client API',
|
|
1342
1324
|
source: path.posix.join(
|
|
@@ -1367,7 +1349,6 @@ describe('site with full autogenerated sidebar', () => {
|
|
|
1367
1349
|
id: 'API/Core APIs/Server API',
|
|
1368
1350
|
unversionedId: 'API/Core APIs/Server API',
|
|
1369
1351
|
sourceDirName: '3-API/01_Core APIs',
|
|
1370
|
-
isDocsHomePage: false,
|
|
1371
1352
|
permalink: '/docs/API/Core APIs/Server API',
|
|
1372
1353
|
slug: '/API/Core APIs/Server API',
|
|
1373
1354
|
source: path.posix.join(
|
|
@@ -1398,7 +1379,6 @@ describe('site with full autogenerated sidebar', () => {
|
|
|
1398
1379
|
id: 'API/Extension APIs/Plugin API',
|
|
1399
1380
|
unversionedId: 'API/Extension APIs/Plugin API',
|
|
1400
1381
|
sourceDirName: '3-API/02_Extension APIs',
|
|
1401
|
-
isDocsHomePage: false,
|
|
1402
1382
|
permalink: '/docs/API/Extension APIs/Plugin API',
|
|
1403
1383
|
slug: '/API/Extension APIs/Plugin API',
|
|
1404
1384
|
source: path.posix.join(
|
|
@@ -1429,7 +1409,6 @@ describe('site with full autogenerated sidebar', () => {
|
|
|
1429
1409
|
id: 'API/Extension APIs/Theme API',
|
|
1430
1410
|
unversionedId: 'API/Extension APIs/Theme API',
|
|
1431
1411
|
sourceDirName: '3-API/02_Extension APIs',
|
|
1432
|
-
isDocsHomePage: false,
|
|
1433
1412
|
permalink: '/docs/API/Extension APIs/Theme API',
|
|
1434
1413
|
slug: '/API/Extension APIs/Theme API',
|
|
1435
1414
|
source: path.posix.join(
|
|
@@ -1460,7 +1439,6 @@ describe('site with full autogenerated sidebar', () => {
|
|
|
1460
1439
|
id: 'API/api-end',
|
|
1461
1440
|
unversionedId: 'API/api-end',
|
|
1462
1441
|
sourceDirName: '3-API',
|
|
1463
|
-
isDocsHomePage: false,
|
|
1464
1442
|
permalink: '/docs/API/api-end',
|
|
1465
1443
|
slug: '/API/api-end',
|
|
1466
1444
|
source: path.posix.join(
|
|
@@ -1555,7 +1533,6 @@ describe('site with partial autogenerated sidebars', () => {
|
|
|
1555
1533
|
id: 'API/api-end',
|
|
1556
1534
|
unversionedId: 'API/api-end',
|
|
1557
1535
|
sourceDirName: '3-API',
|
|
1558
|
-
isDocsHomePage: false,
|
|
1559
1536
|
permalink: '/docs/API/api-end',
|
|
1560
1537
|
slug: '/API/api-end',
|
|
1561
1538
|
source: path.posix.join(
|
|
@@ -1582,7 +1559,6 @@ describe('site with partial autogenerated sidebars', () => {
|
|
|
1582
1559
|
id: 'API/api-overview',
|
|
1583
1560
|
unversionedId: 'API/api-overview',
|
|
1584
1561
|
sourceDirName: '3-API',
|
|
1585
|
-
isDocsHomePage: false,
|
|
1586
1562
|
permalink: '/docs/API/api-overview',
|
|
1587
1563
|
slug: '/API/api-overview',
|
|
1588
1564
|
source: path.posix.join(
|
|
@@ -1612,7 +1588,6 @@ describe('site with partial autogenerated sidebars', () => {
|
|
|
1612
1588
|
id: 'API/Extension APIs/Plugin API',
|
|
1613
1589
|
unversionedId: 'API/Extension APIs/Plugin API',
|
|
1614
1590
|
sourceDirName: '3-API/02_Extension APIs',
|
|
1615
|
-
isDocsHomePage: false,
|
|
1616
1591
|
permalink: '/docs/API/Extension APIs/Plugin API',
|
|
1617
1592
|
slug: '/API/Extension APIs/Plugin API',
|
|
1618
1593
|
source: path.posix.join(
|
|
@@ -1643,7 +1618,6 @@ describe('site with partial autogenerated sidebars', () => {
|
|
|
1643
1618
|
id: 'API/Extension APIs/Theme API',
|
|
1644
1619
|
unversionedId: 'API/Extension APIs/Theme API',
|
|
1645
1620
|
sourceDirName: '3-API/02_Extension APIs',
|
|
1646
|
-
isDocsHomePage: false,
|
|
1647
1621
|
permalink: '/docs/API/Extension APIs/Theme API',
|
|
1648
1622
|
slug: '/API/Extension APIs/Theme API',
|
|
1649
1623
|
source: path.posix.join(
|
|
@@ -41,7 +41,6 @@ describe('normalizeDocsPluginOptions', () => {
|
|
|
41
41
|
path: 'my-docs', // Path to data on filesystem, relative to site dir.
|
|
42
42
|
routeBasePath: 'my-docs', // URL Route.
|
|
43
43
|
tagsBasePath: 'tags', // URL Tags Route.
|
|
44
|
-
homePageId: 'home', // Document id for docs home page.
|
|
45
44
|
include: ['**/*.{md,mdx}'], // Extensions to include.
|
|
46
45
|
exclude: GlobExcludeDefault,
|
|
47
46
|
sidebarPath: 'my-sidebar', // Path to sidebar configuration for showing a list of markdown pages.
|
package/src/docs.ts
CHANGED
|
@@ -126,7 +126,6 @@ function doProcessDocMetadata({
|
|
|
126
126
|
options: MetadataOptions;
|
|
127
127
|
}): DocMetadataBase {
|
|
128
128
|
const {source, content, lastUpdate, contentPath, filePath} = docFile;
|
|
129
|
-
const {homePageId} = options;
|
|
130
129
|
const {siteDir, i18n} = context;
|
|
131
130
|
|
|
132
131
|
const {
|
|
@@ -196,24 +195,14 @@ function doProcessDocMetadata({
|
|
|
196
195
|
// legacy versioned id, requires a breaking change to modify this
|
|
197
196
|
const id = [versionIdPrefix, unversionedId].filter(Boolean).join('/');
|
|
198
197
|
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
const docSlug = isDocsHomePage
|
|
208
|
-
? '/'
|
|
209
|
-
: getSlug({
|
|
210
|
-
baseID,
|
|
211
|
-
source,
|
|
212
|
-
sourceDirName,
|
|
213
|
-
frontmatterSlug: frontMatter.slug,
|
|
214
|
-
stripDirNumberPrefixes: parseNumberPrefixes,
|
|
215
|
-
numberPrefixParser: options.numberPrefixParser,
|
|
216
|
-
});
|
|
198
|
+
const docSlug = getSlug({
|
|
199
|
+
baseID,
|
|
200
|
+
source,
|
|
201
|
+
sourceDirName,
|
|
202
|
+
frontmatterSlug: frontMatter.slug,
|
|
203
|
+
stripDirNumberPrefixes: parseNumberPrefixes,
|
|
204
|
+
numberPrefixParser: options.numberPrefixParser,
|
|
205
|
+
});
|
|
217
206
|
|
|
218
207
|
// Note: the title is used by default for page title, sidebar label, pagination buttons...
|
|
219
208
|
// frontMatter.title should be used in priority over contentTitle (because it can contain markdown/JSX syntax)
|
|
@@ -255,7 +244,6 @@ function doProcessDocMetadata({
|
|
|
255
244
|
return {
|
|
256
245
|
unversionedId,
|
|
257
246
|
id,
|
|
258
|
-
isDocsHomePage,
|
|
259
247
|
title,
|
|
260
248
|
description,
|
|
261
249
|
source: aliasedSitePath(filePath, siteDir),
|