Skip to content

Commit

Permalink
feat(v1): allow specifying meta desc in front matter
Browse files Browse the repository at this point in the history
  • Loading branch information
yangshun committed Oct 20, 2019
1 parent 2c1012b commit 90ffc51
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions docs/api-doc-markdown.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,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`.

`description`: The description of your document which will become the `<meta name="description" content="..."/>` and `<meta property="og:description" content="..."/>` in `<head>`. If this field is not present, it will default to the first line of the contents.

`hide_title`: Whether to hide the title at the top of the doc.

`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`.
Expand Down
1 change: 1 addition & 0 deletions docs/getting-started-installation.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
id: installation
title: Installation
description: Docusaurus was designed from the ground up to be easily installed and used to get your website up and running quickly!
---

Docusaurus was designed from the ground up to be easily installed and used to get your website up and running quickly.
Expand Down
2 changes: 1 addition & 1 deletion packages/docusaurus-1.x/lib/core/DocsLayout.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ class DocsLayout extends React.Component {
separateOnPageNav: hasOnPageNav,
})}
title={title}
description={content.trim().split('\n')[0]}
description={metadata.description || content.trim().split('\n')[0]}
language={metadata.language}
version={metadata.version}
metadata={metadata}>
Expand Down
1 change: 1 addition & 0 deletions packages/docusaurus-1.x/lib/server/readMetadata.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ const SupportedHeaderFields = new Set([
'hide_title',
'layout',
'custom_edit_url',
'description',
]);

let allSidebars;
Expand Down

0 comments on commit 90ffc51

Please sign in to comment.