Doc front matter 介绍
front matter示例🙋
---
//注意:“冒号:” 后面要有个空格
id: doc-markdown
title: Docs Markdown Features
sidebar_label: Markdown
slug: /myDoc
hide_title: false
hide_table_of_contents: false
displayed_sidebar: null //隐藏侧边栏,【实际上是有侧边栏的,只是隐藏了】
title: My Doc Title //默认是文件名作为侧边栏文字;设置title自定义标题
//sidebar_position: 3
description: How do I find you when I cannot solve this problem
keywords:
- docs
- docusaurus
last_update:
date: 1/1/2000
author: custom author name
---
front matter中,可以使用"//"来注释掉某个元素
📝Markdown front matter API 详细列表
| Name | Type | Default | Description |
|---|---|---|---|
id | string | file path (including folders, without the extension) | A unique document ID. |
title | string | Markdown title or id | The text title of your document. Used for the page metadata and as a fallback value in multiple places (sidebar, next/previous buttons...). Automatically added at the top of your doc if it does not contain any Markdown title. |
pagination_label | string | sidebar_label or title | The text used in the document next/previous buttons for this document. |
sidebar_label | string | title | The text shown in the document sidebar for this document. |
sidebar_position | number | Default ordering | Controls the position of a doc inside the generated sidebar slice when using autogenerated sidebar items. See also Autogenerated sidebar metadata. |
sidebar_class_name | string | undefined | Gives the corresponding sidebar label a special class name when using autogenerated sidebars. |
sidebar_custom_props | object | undefined | Assign custom props to the sidebar item referencing this doc |
displayed_sidebar | string | undefined | Force the display of a given sidebar when browsing the current document. Read the multiple sidebars guide for details. |
hide_title | boolean | false | Whether to hide the title at the top of the doc. It only hides a title declared through the front matter, and have no effect on a Markdown title at the top of your document. |
hide_table_of_contents | boolean | false | Whether to hide the table of contents to the right. |
toc_min_heading_level | number | 2 | The minimum heading level shown in the table of contents. Must be between 2 and 6 and lower or equal to the max value. |
toc_max_heading_level | number | 3 | The max heading level shown in the table of contents. Must be between 2 and 6. |
pagination_next | `string | null` | Next doc in the sidebar |
pagination_prev | `string | null` | Previous doc in the sidebar |
parse_number_prefixes | boolean | numberPrefixParser plugin option | Whether number prefix parsing is disabled on this doc. See also Using number prefixes. |
custom_edit_url | string | Computed using the editUrl plugin option | The URL for editing this document. |
keywords | string[] | undefined | Keywords meta tag for the document page, for search engines. |
description | string | The first line of Markdown content | 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. |
image | string | undefined | Cover or thumbnail image that will be used when displaying the link to your post. |
slug | string | File path | Allows to customize the document URL (/<routeBasePath>/<slug>). Support multiple patterns: slug: my-doc, slug: /my/path/myDoc, slug: /. |
tags | Tag[] | undefined | A list of strings or objects of two string fields label and permalink to tag to your docs. |
draft | boolean | false | A boolean flag to indicate that a document is a work-in-progress. Draft documents will only be displayed during development. |
last_update | FileChange | undefined | Allows overriding the last updated author and/or date. Date can be any parsable date string. |
🗃️front matter tips
displayed_sidebar: null
//浏览当前md文件时,隐藏sidebar