Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(v1): allow specifying meta desc in front matter #1859

Merged
merged 2 commits into from
Oct 20, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions docs/api-doc-markdown.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,11 @@ Docusaurus uses [GitHub Flavored Markdown (GFM)](https://guides.github.com/featu

Documents use the following markdown header fields that are enclosed by a line `---` on either side:

`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.

`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`.
- `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.
- `description`: The description of your document which will become the `<meta name="description" content="..."/>` and `<meta property="og:description" content="..."/>` in `<head>`, used by search engines. If this field is not present, it will default to the first line of the contents.
- `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`.

For example:

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
2 changes: 1 addition & 1 deletion website/docs/markdown-features.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ Documents use the following markdown header fields that are enclosed by a line `
- `hide_title`: Whether to hide the title at the top of the doc. 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`.
- `description`: Description meta tag for the document page, for search engines. If this field is not present, it will default to the first line of the contents.
- `keywords`: Keywords meta tag for the document page, for search engines.
- `description`: The description of your document, which will become the `<meta name="description" content="..."/>` and `<meta property="og:description" content="..."/>` in `<head>`, used by search engines. If this field is not present, it will default to the first line of the contents.
- `image`: Cover or thumbnail image that will be used when displaying the link to your post.

Example:
Expand Down