diff --git a/packages/docusaurus-plugin-content-docs/src/__tests__/__snapshots__/index.test.ts.snap b/packages/docusaurus-plugin-content-docs/src/__tests__/__snapshots__/index.test.ts.snap index 244c608c1c0b..5d26371f8dbf 100644 --- a/packages/docusaurus-plugin-content-docs/src/__tests__/__snapshots__/index.test.ts.snap +++ b/packages/docusaurus-plugin-content-docs/src/__tests__/__snapshots__/index.test.ts.snap @@ -66,16 +66,7 @@ exports[`simple website content 1`] = ` "id": "foo/baz", "lastUpdatedAt": undefined, "lastUpdatedBy": undefined, - "next": { - "permalink": "/docs/category/slugs", - "title": "Slugs", - }, "permalink": "/docs/foo/bazSlug.html", - "previous": { - "permalink": "/docs/foo/bar", - "title": "Bar", - }, - "sidebar": "docs", "sidebarPosition": undefined, "slug": "/foo/bazSlug.html", "source": "@site/docs/foo/baz.md", @@ -115,13 +106,7 @@ exports[`simple website content 2`] = ` "id": "hello", "lastUpdatedAt": undefined, "lastUpdatedBy": undefined, - "next": undefined, "permalink": "/docs/", - "previous": { - "permalink": "/docs/headingAsTitle", - "title": "My heading as title", - }, - "sidebar": "docs", "sidebarPosition": undefined, "slug": "/", "source": "@site/docs/hello.md", @@ -158,10 +143,7 @@ exports[`simple website content 3`] = ` "id": "foo/bar", "lastUpdatedAt": undefined, "lastUpdatedBy": undefined, - "next": undefined, "permalink": "/docs/foo/bar", - "previous": undefined, - "sidebar": "docs", "sidebarPosition": undefined, "slug": "/foo/bar", "source": "@site/docs/foo/bar.md", @@ -1774,13 +1756,7 @@ exports[`site with full autogenerated sidebar docs in fully generated sidebar ha "id": "getting-started", "lastUpdatedAt": undefined, "lastUpdatedBy": undefined, - "next": { - "permalink": "/docs/installation", - "title": "Installation", - }, "permalink": "/docs/getting-started", - "previous": undefined, - "sidebar": "defaultSidebar", "sidebarPosition": 0, "slug": "/getting-started", "source": "@site/docs/0-getting-started.md", @@ -1802,16 +1778,7 @@ exports[`site with full autogenerated sidebar docs in fully generated sidebar ha "id": "installation", "lastUpdatedAt": undefined, "lastUpdatedBy": undefined, - "next": { - "permalink": "/docs/Guides/guide1", - "title": "Guide 1", - }, "permalink": "/docs/installation", - "previous": { - "permalink": "/docs/getting-started", - "title": "Getting Started", - }, - "sidebar": "defaultSidebar", "sidebarPosition": 1, "slug": "/installation", "source": "@site/docs/1-installation.md", @@ -1836,16 +1803,7 @@ exports[`site with full autogenerated sidebar docs in fully generated sidebar ha "id": "Guides/guide1", "lastUpdatedAt": undefined, "lastUpdatedBy": undefined, - "next": { - "permalink": "/docs/Guides/guide2", - "title": "Guide 2", - }, "permalink": "/docs/Guides/guide1", - "previous": { - "permalink": "/docs/installation", - "title": "Installation", - }, - "sidebar": "defaultSidebar", "sidebarPosition": 1, "slug": "/Guides/guide1", "source": "@site/docs/Guides/z-guide1.md", @@ -1869,16 +1827,7 @@ exports[`site with full autogenerated sidebar docs in fully generated sidebar ha "id": "Guides/guide2", "lastUpdatedAt": undefined, "lastUpdatedBy": undefined, - "next": { - "permalink": "/docs/Guides/guide2.5", - "title": "Guide 2.5", - }, "permalink": "/docs/Guides/guide2", - "previous": { - "permalink": "/docs/Guides/guide1", - "title": "Guide 1", - }, - "sidebar": "defaultSidebar", "sidebarPosition": 2, "slug": "/Guides/guide2", "source": "@site/docs/Guides/02-guide2.md", @@ -1903,16 +1852,7 @@ exports[`site with full autogenerated sidebar docs in fully generated sidebar ha "id": "Guides/guide2.5", "lastUpdatedAt": undefined, "lastUpdatedBy": undefined, - "next": { - "permalink": "/docs/Guides/guide3", - "title": "Guide 3", - }, "permalink": "/docs/Guides/guide2.5", - "previous": { - "permalink": "/docs/Guides/guide2", - "title": "Guide 2", - }, - "sidebar": "defaultSidebar", "sidebarPosition": 2.5, "slug": "/Guides/guide2.5", "source": "@site/docs/Guides/0-guide2.5.md", @@ -1937,16 +1877,7 @@ exports[`site with full autogenerated sidebar docs in fully generated sidebar ha "id": "Guides/guide3", "lastUpdatedAt": undefined, "lastUpdatedBy": undefined, - "next": { - "permalink": "/docs/Guides/guide4", - "title": "Guide 4", - }, "permalink": "/docs/Guides/guide3", - "previous": { - "permalink": "/docs/Guides/guide2.5", - "title": "Guide 2.5", - }, - "sidebar": "defaultSidebar", "sidebarPosition": 3, "slug": "/Guides/guide3", "source": "@site/docs/Guides/guide3.md", @@ -1970,16 +1901,7 @@ exports[`site with full autogenerated sidebar docs in fully generated sidebar ha "id": "Guides/guide4", "lastUpdatedAt": undefined, "lastUpdatedBy": undefined, - "next": { - "permalink": "/docs/Guides/guide5", - "title": "Guide 5", - }, "permalink": "/docs/Guides/guide4", - "previous": { - "permalink": "/docs/Guides/guide3", - "title": "Guide 3", - }, - "sidebar": "defaultSidebar", "sidebarPosition": undefined, "slug": "/Guides/guide4", "source": "@site/docs/Guides/a-guide4.md", @@ -2003,16 +1925,7 @@ exports[`site with full autogenerated sidebar docs in fully generated sidebar ha "id": "Guides/guide5", "lastUpdatedAt": undefined, "lastUpdatedBy": undefined, - "next": { - "permalink": "/docs/API/api-overview", - "title": "API Overview", - }, "permalink": "/docs/Guides/guide5", - "previous": { - "permalink": "/docs/Guides/guide4", - "title": "Guide 4", - }, - "sidebar": "defaultSidebar", "sidebarPosition": undefined, "slug": "/Guides/guide5", "source": "@site/docs/Guides/b-guide5.md", @@ -2034,16 +1947,7 @@ exports[`site with full autogenerated sidebar docs in fully generated sidebar ha "id": "API/api-overview", "lastUpdatedAt": undefined, "lastUpdatedBy": undefined, - "next": { - "permalink": "/docs/API/Core APIs/Client API", - "title": "Client API", - }, "permalink": "/docs/API/api-overview", - "previous": { - "permalink": "/docs/Guides/guide5", - "title": "Guide 5", - }, - "sidebar": "defaultSidebar", "sidebarPosition": 0, "slug": "/API/api-overview", "source": "@site/docs/3-API/00_api-overview.md", @@ -2065,16 +1969,7 @@ exports[`site with full autogenerated sidebar docs in fully generated sidebar ha "id": "API/Core APIs/Client API", "lastUpdatedAt": undefined, "lastUpdatedBy": undefined, - "next": { - "permalink": "/docs/API/Core APIs/Server API", - "title": "Server API", - }, "permalink": "/docs/API/Core APIs/Client API", - "previous": { - "permalink": "/docs/API/api-overview", - "title": "API Overview", - }, - "sidebar": "defaultSidebar", "sidebarPosition": 0, "slug": "/API/Core APIs/Client API", "source": "@site/docs/3-API/01_Core APIs/0 --- Client API.md", @@ -2096,16 +1991,7 @@ exports[`site with full autogenerated sidebar docs in fully generated sidebar ha "id": "API/Core APIs/Server API", "lastUpdatedAt": undefined, "lastUpdatedBy": undefined, - "next": { - "permalink": "/docs/API/Extension APIs/Plugin API", - "title": "Plugin API", - }, "permalink": "/docs/API/Core APIs/Server API", - "previous": { - "permalink": "/docs/API/Core APIs/Client API", - "title": "Client API", - }, - "sidebar": "defaultSidebar", "sidebarPosition": 1, "slug": "/API/Core APIs/Server API", "source": "@site/docs/3-API/01_Core APIs/1 --- Server API.md", @@ -2127,16 +2013,7 @@ exports[`site with full autogenerated sidebar docs in fully generated sidebar ha "id": "API/Extension APIs/Plugin API", "lastUpdatedAt": undefined, "lastUpdatedBy": undefined, - "next": { - "permalink": "/docs/API/Extension APIs/Theme API", - "title": "Theme API", - }, "permalink": "/docs/API/Extension APIs/Plugin API", - "previous": { - "permalink": "/docs/API/Core APIs/Server API", - "title": "Server API", - }, - "sidebar": "defaultSidebar", "sidebarPosition": 0, "slug": "/API/Extension APIs/Plugin API", "source": "@site/docs/3-API/02_Extension APIs/0. Plugin API.md", @@ -2158,16 +2035,7 @@ exports[`site with full autogenerated sidebar docs in fully generated sidebar ha "id": "API/Extension APIs/Theme API", "lastUpdatedAt": undefined, "lastUpdatedBy": undefined, - "next": { - "permalink": "/docs/API/api-end", - "title": "API End", - }, "permalink": "/docs/API/Extension APIs/Theme API", - "previous": { - "permalink": "/docs/API/Extension APIs/Plugin API", - "title": "Plugin API", - }, - "sidebar": "defaultSidebar", "sidebarPosition": 1, "slug": "/API/Extension APIs/Theme API", "source": "@site/docs/3-API/02_Extension APIs/1. Theme API.md", @@ -2189,13 +2057,7 @@ exports[`site with full autogenerated sidebar docs in fully generated sidebar ha "id": "API/api-end", "lastUpdatedAt": undefined, "lastUpdatedBy": undefined, - "next": undefined, "permalink": "/docs/API/api-end", - "previous": { - "permalink": "/docs/API/Extension APIs/Theme API", - "title": "Theme API", - }, - "sidebar": "defaultSidebar", "sidebarPosition": 3, "slug": "/API/api-end", "source": "@site/docs/3-API/03_api-end.md", @@ -2369,13 +2231,7 @@ exports[`site with partial autogenerated sidebars docs in partially generated si "id": "API/api-end", "lastUpdatedAt": undefined, "lastUpdatedBy": undefined, - "next": { - "permalink": "/docs/API/api-overview", - "title": "API Overview", - }, "permalink": "/docs/API/api-end", - "previous": undefined, - "sidebar": "someSidebar", "sidebarPosition": 3, "slug": "/API/api-end", "source": "@site/docs/3-API/03_api-end.md", @@ -2397,16 +2253,7 @@ exports[`site with partial autogenerated sidebars docs in partially generated si "id": "API/api-overview", "lastUpdatedAt": undefined, "lastUpdatedBy": undefined, - "next": { - "permalink": "/docs/API/Extension APIs/Plugin API", - "title": "Plugin API", - }, "permalink": "/docs/API/api-overview", - "previous": { - "permalink": "/docs/API/api-end", - "title": "API End", - }, - "sidebar": "someSidebar", "sidebarPosition": 0, "slug": "/API/api-overview", "source": "@site/docs/3-API/00_api-overview.md", @@ -2428,16 +2275,7 @@ exports[`site with partial autogenerated sidebars docs in partially generated si "id": "API/Extension APIs/Plugin API", "lastUpdatedAt": undefined, "lastUpdatedBy": undefined, - "next": { - "permalink": "/docs/API/Extension APIs/Theme API", - "title": "Theme API", - }, "permalink": "/docs/API/Extension APIs/Plugin API", - "previous": { - "permalink": "/docs/API/api-overview", - "title": "API Overview", - }, - "sidebar": "someSidebar", "sidebarPosition": 0, "slug": "/API/Extension APIs/Plugin API", "source": "@site/docs/3-API/02_Extension APIs/0. Plugin API.md", @@ -2459,13 +2297,7 @@ exports[`site with partial autogenerated sidebars docs in partially generated si "id": "API/Extension APIs/Theme API", "lastUpdatedAt": undefined, "lastUpdatedBy": undefined, - "next": undefined, "permalink": "/docs/API/Extension APIs/Theme API", - "previous": { - "permalink": "/docs/API/Extension APIs/Plugin API", - "title": "Plugin API", - }, - "sidebar": "someSidebar", "sidebarPosition": 1, "slug": "/API/Extension APIs/Theme API", "source": "@site/docs/3-API/02_Extension APIs/1. Theme API.md", @@ -2521,10 +2353,7 @@ exports[`versioned website (community) content 1`] = ` "id": "team", "lastUpdatedAt": undefined, "lastUpdatedBy": undefined, - "next": undefined, "permalink": "/community/next/team", - "previous": undefined, - "sidebar": "community", "sidebarPosition": undefined, "slug": "/team", "source": "@site/i18n/en/docusaurus-plugin-content-docs-community/current/team.md", @@ -2546,10 +2375,7 @@ exports[`versioned website (community) content 2`] = ` "id": "version-1.0.0/team", "lastUpdatedAt": undefined, "lastUpdatedBy": undefined, - "next": undefined, "permalink": "/community/team", - "previous": undefined, - "sidebar": "version-1.0.0/community", "sidebarPosition": undefined, "slug": "/team", "source": "@site/community_versioned_docs/version-1.0.0/team.md", @@ -2834,13 +2660,7 @@ exports[`versioned website content 1`] = ` "id": "foo/bar", "lastUpdatedAt": undefined, "lastUpdatedBy": undefined, - "next": { - "permalink": "/docs/next/", - "title": "hello", - }, "permalink": "/docs/next/foo/barSlug", - "previous": undefined, - "sidebar": "docs", "sidebarPosition": undefined, "slug": "/foo/barSlug", "source": "@site/docs/foo/bar.md", @@ -2875,13 +2695,7 @@ exports[`versioned website content 2`] = ` "id": "version-1.0.1/foo/bar", "lastUpdatedAt": undefined, "lastUpdatedBy": undefined, - "next": { - "permalink": "/docs/", - "title": "hello", - }, "permalink": "/docs/foo/bar", - "previous": undefined, - "sidebar": "VersionedSideBarNameDoesNotMatter/docs", "sidebarPosition": undefined, "slug": "/foo/bar", "source": "@site/versioned_docs/version-1.0.1/foo/bar.md", @@ -2905,13 +2719,7 @@ exports[`versioned website content 3`] = ` "id": "hello", "lastUpdatedAt": undefined, "lastUpdatedBy": undefined, - "next": undefined, "permalink": "/docs/next/", - "previous": { - "permalink": "/docs/next/foo/barSlug", - "title": "bar", - }, - "sidebar": "docs", "sidebarPosition": undefined, "slug": "/", "source": "@site/docs/hello.md", @@ -2935,13 +2743,7 @@ exports[`versioned website content 4`] = ` "id": "version-1.0.1/hello", "lastUpdatedAt": undefined, "lastUpdatedBy": undefined, - "next": undefined, "permalink": "/docs/", - "previous": { - "permalink": "/docs/foo/bar", - "title": "bar", - }, - "sidebar": "VersionedSideBarNameDoesNotMatter/docs", "sidebarPosition": undefined, "slug": "/", "source": "@site/versioned_docs/version-1.0.1/hello.md", @@ -2963,16 +2765,7 @@ exports[`versioned website content 5`] = ` "id": "version-1.0.0/foo/baz", "lastUpdatedAt": undefined, "lastUpdatedBy": undefined, - "next": { - "permalink": "/docs/1.0.0/", - "title": "hello", - }, "permalink": "/docs/1.0.0/foo/baz", - "previous": { - "permalink": "/docs/1.0.0/foo/barSlug", - "title": "bar", - }, - "sidebar": "version-1.0.0/docs", "sidebarPosition": undefined, "slug": "/foo/baz", "source": "@site/versioned_docs/version-1.0.0/foo/baz.md", diff --git a/packages/docusaurus-plugin-content-docs/src/__tests__/__snapshots__/translations.test.ts.snap b/packages/docusaurus-plugin-content-docs/src/__tests__/__snapshots__/translations.test.ts.snap index bd51f4568621..61f0b4067610 100644 --- a/packages/docusaurus-plugin-content-docs/src/__tests__/__snapshots__/translations.test.ts.snap +++ b/packages/docusaurus-plugin-content-docs/src/__tests__/__snapshots__/translations.test.ts.snap @@ -223,6 +223,7 @@ exports[`translateLoadedContent returns translated loaded content 1`] = ` "drafts": [], "isLast": true, "label": "current label (translated)", + "noIndex": false, "path": "/docs/", "routePriority": undefined, "sidebarFilePath": "any", @@ -399,6 +400,7 @@ exports[`translateLoadedContent returns translated loaded content 1`] = ` "drafts": [], "isLast": true, "label": "2.0.0 label (translated)", + "noIndex": false, "path": "/docs/", "routePriority": undefined, "sidebarFilePath": "any", @@ -575,6 +577,7 @@ exports[`translateLoadedContent returns translated loaded content 1`] = ` "drafts": [], "isLast": true, "label": "1.0.0 label (translated)", + "noIndex": false, "path": "/docs/", "routePriority": undefined, "sidebarFilePath": "any", diff --git a/packages/docusaurus-plugin-content-docs/src/__tests__/index.test.ts b/packages/docusaurus-plugin-content-docs/src/__tests__/index.test.ts index f7672377404f..7598112f1362 100644 --- a/packages/docusaurus-plugin-content-docs/src/__tests__/index.test.ts +++ b/packages/docusaurus-plugin-content-docs/src/__tests__/index.test.ts @@ -25,6 +25,7 @@ import {DisabledSidebars} from '../sidebars'; import * as cliDocs from '../cli'; import {validateOptions} from '../options'; +import type {FullVersion} from '../types'; import type {RouteConfig, Validate, Plugin} from '@docusaurus/types'; import type { LoadedVersion, @@ -108,7 +109,9 @@ Entries created: const versionMetadataProp = getCreatedDataByPrefix( `version-${_.kebabCase(version.versionName)}-metadata-prop`, ); - expect(versionMetadataProp.docsSidebars).toEqual(toSidebarsProp(version)); + expect(versionMetadataProp.docsSidebars).toEqual( + toSidebarsProp(version as FullVersion), + ); }, expectSnapshot: () => { @@ -608,7 +611,7 @@ describe('site with doc label', () => { it('label in sidebar.json is used', async () => { const {content} = await loadSite(); const loadedVersion = content.loadedVersions[0]!; - const sidebarProps = toSidebarsProp(loadedVersion); + const sidebarProps = toSidebarsProp(loadedVersion as FullVersion); expect((sidebarProps.docs![0] as PropSidebarItemLink).label).toBe( 'Hello One', @@ -618,7 +621,7 @@ describe('site with doc label', () => { it('sidebar_label in doc has higher precedence over label in sidebar.json', async () => { const {content} = await loadSite(); const loadedVersion = content.loadedVersions[0]!; - const sidebarProps = toSidebarsProp(loadedVersion); + const sidebarProps = toSidebarsProp(loadedVersion as FullVersion); expect((sidebarProps.docs![1] as PropSidebarItemLink).label).toBe( 'Hello 2 From Doc', diff --git a/packages/docusaurus-plugin-content-docs/src/__tests__/translations.test.ts b/packages/docusaurus-plugin-content-docs/src/__tests__/translations.test.ts index 4c5392e28301..6294adb59491 100644 --- a/packages/docusaurus-plugin-content-docs/src/__tests__/translations.test.ts +++ b/packages/docusaurus-plugin-content-docs/src/__tests__/translations.test.ts @@ -57,6 +57,7 @@ function createSampleVersion( badge: true, className: '', drafts: [], + noIndex: false, docs: [ createSampleDoc({id: 'doc1'}), createSampleDoc({id: 'doc2'}), diff --git a/packages/docusaurus-plugin-content-docs/src/index.ts b/packages/docusaurus-plugin-content-docs/src/index.ts index 74eac5d38afe..3f5f748d4cc8 100644 --- a/packages/docusaurus-plugin-content-docs/src/index.ts +++ b/packages/docusaurus-plugin-content-docs/src/index.ts @@ -21,12 +21,7 @@ import { } from '@docusaurus/utils'; import {loadSidebars, resolveSidebarPathOption} from './sidebars'; import {CategoryMetadataFilenamePattern} from './sidebars/generator'; -import { - readVersionDocs, - processDocMetadata, - addDocNavigation, - type DocEnv, -} from './docs'; +import {readVersionDocs, processDocMetadata, type DocEnv} from './docs'; import {readVersionsMetadata, toFullVersion} from './versions'; import {cliDocsVersionCommand} from './cli'; import {VERSIONS_JSON_FILE} from './constants'; @@ -36,7 +31,6 @@ import { getLoadedContentTranslationFiles, } from './translations'; import {createAllRoutes} from './routes'; -import {createSidebarsUtils} from './sidebars/utils'; import type { PluginOptions, @@ -171,18 +165,7 @@ export default async function pluginContentDocs( categoryLabelSlugger: createSlugger(), }); - const sidebarsUtils = createSidebarsUtils(sidebars); - - return { - ...versionMetadata, - docs: addDocNavigation( - docs, - sidebarsUtils, - versionMetadata.sidebarFilePath as string, - ), - drafts, - sidebars, - }; + return {...versionMetadata, docs, drafts, sidebars}; } async function loadVersion(versionMetadata: VersionMetadata) { diff --git a/packages/docusaurus-plugin-content-docs/src/plugin-content-docs.d.ts b/packages/docusaurus-plugin-content-docs/src/plugin-content-docs.d.ts index 3ae1e0fb7acc..d84c68658c3f 100644 --- a/packages/docusaurus-plugin-content-docs/src/plugin-content-docs.d.ts +++ b/packages/docusaurus-plugin-content-docs/src/plugin-content-docs.d.ts @@ -559,8 +559,8 @@ declare module '@docusaurus/plugin-content-docs' { }; export type LoadedVersion = VersionMetadata & { - docs: DocMetadata[]; - drafts: DocMetadata[]; + docs: DocMetadataBase[]; + drafts: DocMetadataBase[]; sidebars: import('./sidebars/types').Sidebars; }; diff --git a/packages/docusaurus-plugin-content-docs/src/props.ts b/packages/docusaurus-plugin-content-docs/src/props.ts index c9f58096ac50..9186672f2799 100644 --- a/packages/docusaurus-plugin-content-docs/src/props.ts +++ b/packages/docusaurus-plugin-content-docs/src/props.ts @@ -7,7 +7,7 @@ import _ from 'lodash'; import {createDocsByIdIndex} from './docs'; -import type {VersionTag, VersionTags} from './types'; +import type {VersionTag, VersionTags, FullVersion} from './types'; import type { SidebarItemDoc, SidebarItem, @@ -25,10 +25,9 @@ import type { PropSidebarItemLink, PropVersionDocs, DocMetadata, - LoadedVersion, } from '@docusaurus/plugin-content-docs'; -export function toSidebarsProp(loadedVersion: LoadedVersion): PropSidebars { +export function toSidebarsProp(loadedVersion: FullVersion): PropSidebars { const docsById = createDocsByIdIndex(loadedVersion.docs); function getDocById(docId: string): DocMetadata { @@ -119,7 +118,7 @@ Available document ids are: ); } -function toVersionDocsProp(loadedVersion: LoadedVersion): PropVersionDocs { +function toVersionDocsProp(loadedVersion: FullVersion): PropVersionDocs { return Object.fromEntries( loadedVersion.docs.map((doc) => [ doc.unversionedId, @@ -135,7 +134,7 @@ function toVersionDocsProp(loadedVersion: LoadedVersion): PropVersionDocs { export function toVersionMetadataProp( pluginId: string, - loadedVersion: LoadedVersion, + loadedVersion: FullVersion, ): PropVersionMetadata { return { pluginId, diff --git a/packages/docusaurus-plugin-content-docs/src/types.ts b/packages/docusaurus-plugin-content-docs/src/types.ts index 4c4568517fbb..8af178526240 100644 --- a/packages/docusaurus-plugin-content-docs/src/types.ts +++ b/packages/docusaurus-plugin-content-docs/src/types.ts @@ -9,6 +9,7 @@ import type {BrokenMarkdownLink, Tag} from '@docusaurus/utils'; import type { VersionMetadata, LoadedVersion, + DocMetadata, CategoryGeneratedIndexMetadata, } from '@docusaurus/plugin-content-docs'; import type {SidebarsUtils} from './sidebars/utils'; @@ -32,7 +33,9 @@ export type VersionTags = { [permalink: string]: VersionTag; }; -export type FullVersion = LoadedVersion & { +export type FullVersion = Omit & { + docs: DocMetadata[]; + drafts: DocMetadata[]; sidebarsUtils: SidebarsUtils; categoryGeneratedIndices: CategoryGeneratedIndexMetadata[]; }; diff --git a/packages/docusaurus-plugin-content-docs/src/versions/index.ts b/packages/docusaurus-plugin-content-docs/src/versions/index.ts index f9be8149a853..72a58244a778 100644 --- a/packages/docusaurus-plugin-content-docs/src/versions/index.ts +++ b/packages/docusaurus-plugin-content-docs/src/versions/index.ts @@ -16,6 +16,7 @@ import { } from './files'; import {createSidebarsUtils} from '../sidebars/utils'; import {getCategoryGeneratedIndexMetadataList} from '../categoryGeneratedIndex'; +import {addDocNavigation} from '../docs'; import type {FullVersion} from '../types'; import type {LoadContext} from '@docusaurus/types'; import type { @@ -261,6 +262,11 @@ export function toFullVersion(version: LoadedVersion): FullVersion { const sidebarsUtils = createSidebarsUtils(version.sidebars); return { ...version, + docs: addDocNavigation( + version.docs, + sidebarsUtils, + version.sidebarFilePath as string, + ), sidebarsUtils, categoryGeneratedIndices: getCategoryGeneratedIndexMetadataList({ docs: version.docs,