mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-12 00:27:21 +02:00
refactor: remove deprecated docs homePageId option (#6065)
This commit is contained in:
parent
c64987e2c8
commit
f96a051fbe
17 changed files with 96 additions and 175 deletions
|
@ -126,7 +126,6 @@ function doProcessDocMetadata({
|
|||
options: MetadataOptions;
|
||||
}): DocMetadataBase {
|
||||
const {source, content, lastUpdate, contentPath, filePath} = docFile;
|
||||
const {homePageId} = options;
|
||||
const {siteDir, i18n} = context;
|
||||
|
||||
const {
|
||||
|
@ -196,24 +195,14 @@ function doProcessDocMetadata({
|
|||
// legacy versioned id, requires a breaking change to modify this
|
||||
const id = [versionIdPrefix, unversionedId].filter(Boolean).join('/');
|
||||
|
||||
// TODO remove soon, deprecated homePageId
|
||||
const isDocsHomePage = unversionedId === (homePageId ?? '_index');
|
||||
if (frontMatter.slug && isDocsHomePage) {
|
||||
throw new Error(
|
||||
`The docs homepage (homePageId=${homePageId}) is not allowed to have a frontmatter slug=${frontMatter.slug} => you have to choose either homePageId or slug, not both`,
|
||||
);
|
||||
}
|
||||
|
||||
const docSlug = isDocsHomePage
|
||||
? '/'
|
||||
: getSlug({
|
||||
baseID,
|
||||
source,
|
||||
sourceDirName,
|
||||
frontmatterSlug: frontMatter.slug,
|
||||
stripDirNumberPrefixes: parseNumberPrefixes,
|
||||
numberPrefixParser: options.numberPrefixParser,
|
||||
});
|
||||
const docSlug = getSlug({
|
||||
baseID,
|
||||
source,
|
||||
sourceDirName,
|
||||
frontmatterSlug: frontMatter.slug,
|
||||
stripDirNumberPrefixes: parseNumberPrefixes,
|
||||
numberPrefixParser: options.numberPrefixParser,
|
||||
});
|
||||
|
||||
// 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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue