diff --git a/packages/docusaurus-plugin-typedoc/src/front-matter.ts b/packages/docusaurus-plugin-typedoc/src/front-matter.ts index a006ccc7f..2a59a25ee 100644 --- a/packages/docusaurus-plugin-typedoc/src/front-matter.ts +++ b/packages/docusaurus-plugin-typedoc/src/front-matter.ts @@ -52,6 +52,9 @@ export class FrontMatterComponent extends RendererComponent { if (sidebarLabel && sidebarLabel !== pageTitle) { items = { ...items, sidebar_label: sidebarLabel }; } + if (page.url === page.project.url) { + items = { ...items, hide_table_of_contents: true }; + } return { ...items, custom_edit_url: null, diff --git a/packages/docusaurus-plugin-typedoc/src/types.ts b/packages/docusaurus-plugin-typedoc/src/types.ts index eb7c61cea..2e08f56ef 100644 --- a/packages/docusaurus-plugin-typedoc/src/types.ts +++ b/packages/docusaurus-plugin-typedoc/src/types.ts @@ -23,6 +23,7 @@ export interface FrontMatter { slug?: string; sidebar_label?: string; hide_title?: boolean; + hide_table_of_contents?: boolean; } export interface SidebarOptions { diff --git a/packages/docusaurus-plugin-typedoc/test/specs/__snapshots__/front-matter.spec.ts.snap b/packages/docusaurus-plugin-typedoc/test/specs/__snapshots__/front-matter.spec.ts.snap index 7988000e8..d4a47e5f5 100644 --- a/packages/docusaurus-plugin-typedoc/test/specs/__snapshots__/front-matter.spec.ts.snap +++ b/packages/docusaurus-plugin-typedoc/test/specs/__snapshots__/front-matter.spec.ts.snap @@ -5,6 +5,7 @@ exports[`FrontMatter: (globals) should set custom indexLabel 1`] = ` id: \\"modules\\" title: \\"test-project-name\\" sidebar_label: \\"Custom index label\\" +hide_table_of_contents: true custom_edit_url: null hide_title: true --- @@ -17,6 +18,7 @@ exports[`FrontMatter: (globals) should set default globals page 1`] = ` id: \\"modules\\" title: \\"test-project-name\\" sidebar_label: \\"Table of contents\\" +hide_table_of_contents: true custom_edit_url: null hide_title: true --- @@ -30,6 +32,7 @@ id: \\"index\\" title: \\"test-project-name\\" slug: \\"/api\\" sidebar_label: \\"Table of contents\\" +hide_table_of_contents: true custom_edit_url: null hide_title: true --- @@ -41,6 +44,7 @@ exports[`FrontMatter: (no sidebar) should return front matter without sidebar 1` "--- id: \\"modules\\" title: \\"test-project-name\\" +hide_table_of_contents: true custom_edit_url: null hide_title: true ---