This commit is contained in:
Mark 2025-04-15 10:26:19 -04:00 committed by GitHub
commit d029b0c0b4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -176,7 +176,12 @@ async function doProcessDocMetadata({
// Note: the title is used by default for page title, sidebar label,
// pagination buttons... frontMatter.title should be used in priority over
// contentTitle (because it can contain markdown/JSX syntax)
const title: string = frontMatter.title ?? contentTitle ?? baseID;
// if filename is `index` or `readme`, then use the parent directory name
const derivedNameFromPath = /^(?:index|readme)$/i.test(baseID)
? path.basename(sourceDirName)
: unprefixedFileName;
const title: string =
frontMatter.title ?? contentTitle ?? derivedNameFromPath;
const description: string = frontMatter.description ?? excerpt ?? '';