mirror of
https://github.com/facebook/docusaurus.git
synced 2025-07-23 19:48:54 +02:00
feat(content-docs): expose isCategoryIndex matcher to customize conventions (#6451)
Co-authored-by: sebastienlorber <lorber.sebastien@gmail.com>
This commit is contained in:
parent
76a8d5f38a
commit
24a895fbc5
16 changed files with 408 additions and 93 deletions
|
@ -16,7 +16,7 @@ import {
|
|||
stripPathNumberPrefixes,
|
||||
} from './numberPrefix';
|
||||
import type {DocMetadataBase} from './types';
|
||||
import {isConventionalDocIndex} from './docs';
|
||||
import {isCategoryIndex, toCategoryIndexMatcherParam} from './docs';
|
||||
import type {NumberPrefixParser} from '@docusaurus/plugin-content-docs';
|
||||
|
||||
export default function getSlug({
|
||||
|
@ -29,7 +29,7 @@ export default function getSlug({
|
|||
}: {
|
||||
baseID: string;
|
||||
frontMatterSlug?: string;
|
||||
source: DocMetadataBase['slug'];
|
||||
source: DocMetadataBase['source'];
|
||||
sourceDirName: DocMetadataBase['sourceDirName'];
|
||||
stripDirNumberPrefixes?: boolean;
|
||||
numberPrefixParser?: NumberPrefixParser;
|
||||
|
@ -50,7 +50,10 @@ export default function getSlug({
|
|||
return frontMatterSlug;
|
||||
} else {
|
||||
const dirNameSlug = getDirNameSlug();
|
||||
if (!frontMatterSlug && isConventionalDocIndex({source, sourceDirName})) {
|
||||
if (
|
||||
!frontMatterSlug &&
|
||||
isCategoryIndex(toCategoryIndexMatcherParam({source, sourceDirName}))
|
||||
) {
|
||||
return dirNameSlug;
|
||||
}
|
||||
const baseSlug = frontMatterSlug || baseID;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue