Skip to content

Commit

Permalink
feat: Remove side TOC on index page
Browse files Browse the repository at this point in the history
  • Loading branch information
tgreyuk committed Mar 22, 2021
1 parent 00da7eb commit 07ed973
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/docusaurus-plugin-typedoc/src/front-matter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions packages/docusaurus-plugin-typedoc/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export interface FrontMatter {
slug?: string;
sidebar_label?: string;
hide_title?: boolean;
hide_table_of_contents?: boolean;
}

export interface SidebarOptions {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
---
Expand All @@ -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
---
Expand All @@ -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
---
Expand All @@ -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
---
Expand Down

0 comments on commit 07ed973

Please sign in to comment.