mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-13 09:07:29 +02:00
refactor(v2): remove sidebar_label filed from doc metadata file (#4863)
This commit is contained in:
parent
644f148a8b
commit
d72f760e4d
5 changed files with 6 additions and 7 deletions
|
@ -76,7 +76,7 @@ function createTestUtils({
|
||||||
docFileSource: string,
|
docFileSource: string,
|
||||||
expectedMetadata: Optional<
|
expectedMetadata: Optional<
|
||||||
DocMetadataBase,
|
DocMetadataBase,
|
||||||
'source' | 'lastUpdatedBy' | 'lastUpdatedAt' | 'sidebar_label' | 'editUrl'
|
'source' | 'lastUpdatedBy' | 'lastUpdatedAt' | 'editUrl'
|
||||||
>,
|
>,
|
||||||
) {
|
) {
|
||||||
const docFile = await readDoc(docFileSource);
|
const docFile = await readDoc(docFileSource);
|
||||||
|
@ -89,7 +89,6 @@ function createTestUtils({
|
||||||
expect(metadata).toEqual({
|
expect(metadata).toEqual({
|
||||||
lastUpdatedBy: undefined,
|
lastUpdatedBy: undefined,
|
||||||
lastUpdatedAt: undefined,
|
lastUpdatedAt: undefined,
|
||||||
sidebar_label: undefined,
|
|
||||||
editUrl: undefined,
|
editUrl: undefined,
|
||||||
source: path.posix.join(
|
source: path.posix.join(
|
||||||
'@site',
|
'@site',
|
||||||
|
|
|
@ -57,7 +57,6 @@ const defaultDocMetadata: Partial<DocMetadata> = {
|
||||||
editUrl: undefined,
|
editUrl: undefined,
|
||||||
lastUpdatedAt: undefined,
|
lastUpdatedAt: undefined,
|
||||||
lastUpdatedBy: undefined,
|
lastUpdatedBy: undefined,
|
||||||
sidebar_label: undefined,
|
|
||||||
formattedLastUpdatedAt: undefined,
|
formattedLastUpdatedAt: undefined,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -125,7 +125,6 @@ export function processDocMetadata({
|
||||||
const frontMatter = validateDocFrontMatter(unsafeFrontMatter);
|
const frontMatter = validateDocFrontMatter(unsafeFrontMatter);
|
||||||
|
|
||||||
const {
|
const {
|
||||||
sidebar_label: sidebarLabel,
|
|
||||||
custom_edit_url: customEditURL,
|
custom_edit_url: customEditURL,
|
||||||
|
|
||||||
// Strip number prefixes by default (01-MyFolder/01-MyDoc.md => MyFolder/MyDoc) by default,
|
// Strip number prefixes by default (01-MyFolder/01-MyDoc.md => MyFolder/MyDoc) by default,
|
||||||
|
@ -261,7 +260,6 @@ export function processDocMetadata({
|
||||||
lastUpdate.lastUpdatedAt * 1000,
|
lastUpdate.lastUpdatedAt * 1000,
|
||||||
)
|
)
|
||||||
: undefined,
|
: undefined,
|
||||||
sidebar_label: sidebarLabel,
|
|
||||||
sidebarPosition,
|
sidebarPosition,
|
||||||
frontMatter,
|
frontMatter,
|
||||||
};
|
};
|
||||||
|
|
|
@ -33,7 +33,11 @@ Available document ids=
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const {title, permalink, sidebar_label: sidebarLabel} = docMetadata;
|
const {
|
||||||
|
title,
|
||||||
|
permalink,
|
||||||
|
frontMatter: {sidebar_label: sidebarLabel},
|
||||||
|
} = docMetadata;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
type: 'link',
|
type: 'link',
|
||||||
|
|
|
@ -198,7 +198,6 @@ export type DocMetadataBase = LastUpdateData & {
|
||||||
slug: string;
|
slug: string;
|
||||||
permalink: string;
|
permalink: string;
|
||||||
// eslint-disable-next-line camelcase
|
// eslint-disable-next-line camelcase
|
||||||
sidebar_label?: string;
|
|
||||||
sidebarPosition?: number;
|
sidebarPosition?: number;
|
||||||
editUrl?: string | null;
|
editUrl?: string | null;
|
||||||
frontMatter: FrontMatter;
|
frontMatter: FrontMatter;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue