mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-11 08:07:26 +02:00
Add hide_title metadata that hides the title text on the top of the doc (#540)
This commit is contained in:
parent
ad5b8b92b4
commit
6dd6ead19f
4 changed files with 3842 additions and 16 deletions
|
@ -13,6 +13,8 @@ Documents use the following markdown header fields that are enclosed by a line `
|
||||||
|
|
||||||
`title`: The title of your document. If this field is not present, the document's `title` will default to its `id`.
|
`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.
|
||||||
|
|
||||||
`sidebar_label`: The text shown in the document sidebar for this document. If this field is not present, the document's `sidebar_label` will default to its `title`.
|
`sidebar_label`: The text shown in the document sidebar for this document. If this field is not present, the document's `sidebar_label` will default to its `title`.
|
||||||
|
|
||||||
For example:
|
For example:
|
||||||
|
|
|
@ -60,11 +60,12 @@ class Doc extends React.Component {
|
||||||
</a>
|
</a>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="post">
|
<div className="post">
|
||||||
<header className="postHeader">
|
<header className="postHeader">
|
||||||
{editLink}
|
{editLink}
|
||||||
<h1>{this.props.title}</h1>
|
{!this.props.hideTitle && <h1>{this.props.title}</h1>}
|
||||||
</header>
|
</header>
|
||||||
<article>
|
<article>
|
||||||
<MarkdownBlock>{this.props.content}</MarkdownBlock>
|
<MarkdownBlock>{this.props.content}</MarkdownBlock>
|
||||||
|
|
|
@ -23,17 +23,16 @@ class DocsLayout extends React.Component {
|
||||||
if (this.props.Doc) {
|
if (this.props.Doc) {
|
||||||
DocComponent = this.props.Doc;
|
DocComponent = this.props.Doc;
|
||||||
}
|
}
|
||||||
|
const title = i18n
|
||||||
|
? translation[this.props.metadata.language]['localized-strings'][
|
||||||
|
this.props.metadata.localized_id
|
||||||
|
] || this.props.metadata.title
|
||||||
|
: this.props.metadata.title;
|
||||||
return (
|
return (
|
||||||
<Site
|
<Site
|
||||||
config={this.props.config}
|
config={this.props.config}
|
||||||
className="sideNavVisible doc"
|
className="sideNavVisible doc"
|
||||||
title={
|
title={title}
|
||||||
i18n
|
|
||||||
? translation[this.props.metadata.language]['localized-strings'][
|
|
||||||
this.props.metadata.localized_id
|
|
||||||
] || this.props.metadata.title
|
|
||||||
: this.props.metadata.title
|
|
||||||
}
|
|
||||||
description={content.trim().split('\n')[0]}
|
description={content.trim().split('\n')[0]}
|
||||||
language={metadata.language}
|
language={metadata.language}
|
||||||
version={metadata.version}
|
version={metadata.version}
|
||||||
|
@ -46,14 +45,8 @@ class DocsLayout extends React.Component {
|
||||||
content={content}
|
content={content}
|
||||||
config={this.props.config}
|
config={this.props.config}
|
||||||
source={metadata.source}
|
source={metadata.source}
|
||||||
title={
|
hideTitle={this.props.metadata.hide_title}
|
||||||
i18n
|
title={title}
|
||||||
? translation[this.props.metadata.language][
|
|
||||||
'localized-strings'
|
|
||||||
][this.props.metadata.localized_id] ||
|
|
||||||
this.props.metadata.title
|
|
||||||
: this.props.metadata.title
|
|
||||||
}
|
|
||||||
version={metadata.version}
|
version={metadata.version}
|
||||||
language={metadata.language}
|
language={metadata.language}
|
||||||
/>
|
/>
|
||||||
|
|
3830
yarn-error.log
Normal file
3830
yarn-error.log
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue