跳到主要内容

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 详细列表

NameTypeDefaultDescription
idstringfile path (including folders, without the extension)A unique document ID.
titlestringMarkdown title or idThe 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_labelstringsidebar_label or titleThe text used in the document next/previous buttons for this document.
sidebar_labelstringtitleThe text shown in the document sidebar for this document.
sidebar_positionnumberDefault orderingControls the position of a doc inside the generated sidebar slice when using autogenerated sidebar items. See also Autogenerated sidebar metadata.
sidebar_class_namestringundefinedGives the corresponding sidebar label a special class name when using autogenerated sidebars.
sidebar_custom_propsobjectundefinedAssign custom props to the sidebar item referencing this doc
displayed_sidebarstringundefinedForce the display of a given sidebar when browsing the current document. Read the multiple sidebars guide for details.
hide_titlebooleanfalseWhether 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_contentsbooleanfalseWhether to hide the table of contents to the right.
toc_min_heading_levelnumber2The 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_levelnumber3The max heading level shown in the table of contents. Must be between 2 and 6.
pagination_next`stringnull`Next doc in the sidebar
pagination_prev`stringnull`Previous doc in the sidebar
parse_number_prefixesbooleannumberPrefixParser plugin optionWhether number prefix parsing is disabled on this doc. See also Using number prefixes.
custom_edit_urlstringComputed using the editUrl plugin optionThe URL for editing this document.
keywordsstring[]undefinedKeywords meta tag for the document page, for search engines.
descriptionstringThe first line of Markdown contentThe description of your document, which will become the <meta name="description" content="..."/> and <meta property="og:description" content="..."/> in <head>, used by search engines.
imagestringundefinedCover or thumbnail image that will be used when displaying the link to your post.
slugstringFile pathAllows to customize the document URL (/<routeBasePath>/<slug>). Support multiple patterns: slug: my-doc, slug: /my/path/myDoc, slug: /.
tagsTag[]undefinedA list of strings or objects of two string fields label and permalink to tag to your docs.
draftbooleanfalseA boolean flag to indicate that a document is a work-in-progress. Draft documents will only be displayed during development.
last_updateFileChangeundefinedAllows overriding the last updated author and/or date. Date can be any parsable date string.

🗃️front matter tips

displayed_sidebar: null
//浏览当前md文件时,隐藏sidebar