diff --git a/packages/docusaurus-plugin-content-docs/src/types.ts b/packages/docusaurus-plugin-content-docs/src/types.ts index faaf3fb7be0c..23ab9b380d92 100644 --- a/packages/docusaurus-plugin-content-docs/src/types.ts +++ b/packages/docusaurus-plugin-content-docs/src/types.ts @@ -94,7 +94,6 @@ export interface MetadataRaw extends OrderMetadata { editUrl?: string; lastUpdatedAt?: number; lastUpdatedBy?: string; - hide_title?: boolean; [key: string]: any; } diff --git a/packages/docusaurus-theme-classic/src/theme/DocItem/index.js b/packages/docusaurus-theme-classic/src/theme/DocItem/index.js index 707c8f58a92f..b45719bddb2a 100644 --- a/packages/docusaurus-theme-classic/src/theme/DocItem/index.js +++ b/packages/docusaurus-theme-classic/src/theme/DocItem/index.js @@ -63,6 +63,12 @@ function DocItem(props) { lastUpdatedBy, keywords, } = metadata; + const { + frontMatter: { + hide_title: hideTitle, + hide_table_of_contents: hideTableOfContents, + }, + } = DocContent; const metaImageUrl = siteUrl + useBaseUrl(metaImage); @@ -90,7 +96,7 @@ function DocItem(props) {
- {!metadata.hide_title && ( + {!hideTitle && (

{metadata.title}

@@ -172,7 +178,9 @@ function DocItem(props) {
- {DocContent.rightToc && } + {!hideTableOfContents && DocContent.rightToc && ( + + )} diff --git a/packages/docusaurus-theme-classic/src/theme/DocItem/styles.module.css b/packages/docusaurus-theme-classic/src/theme/DocItem/styles.module.css index adfb5a0dc583..d1c2932c0206 100644 --- a/packages/docusaurus-theme-classic/src/theme/DocItem/styles.module.css +++ b/packages/docusaurus-theme-classic/src/theme/DocItem/styles.module.css @@ -20,7 +20,6 @@ .docItemContainer { margin: 0 auto; padding: 0 0.5rem; - max-width: 45em; } .tableOfContents { diff --git a/website/docs/markdown-features.mdx b/website/docs/markdown-features.mdx index ad36da15c93c..1836099fa9f6 100644 --- a/website/docs/markdown-features.mdx +++ b/website/docs/markdown-features.mdx @@ -99,6 +99,7 @@ Documents use the following markdown header fields that are enclosed by a line ` - `id`: A unique document id. If this field is not present, the document's `id` will default to its file name (without the extension). - `title`: The title of your document. If this field is not present, the document's `title` will default to its `id`. - `hide_title`: Whether to hide the title at the top of the doc. By default it is `false`. +- `hide_table_of_contents`: Whether to hide the table of contents to the right. By default it is `false`. - `sidebar_label`: The text shown in the document sidebar and in the next/previous button for this document. If this field is not present, the document's `sidebar_label` will default to its `title`. - `custom_edit_url`: The URL for editing this document. If this field is not present, the document's edit URL will fall back to `editUrl` from options fields passed to `docusaurus-plugin-content-docs`. - `keywords`: Keywords meta tag for the document page, for search engines. @@ -112,6 +113,7 @@ Example: id: doc-markdown title: Markdown Features hide_title: false +hide_table_of_contents: false sidebar_label: Markdown :) custom_edit_url: https://github.com/facebook/docusaurus/edit/master/docs/api-doc-markdown.md description: How do I find you when I cannot solve this problem