-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Kia King Ishii <[email protected]>
- Loading branch information
Showing
3 changed files
with
90 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
# Frontmatter | ||
|
||
Any Markdown file that contains a YAML frontmatter block will be processed by [gray-matter](https://github.com/jonschlinkert/gray-matter). The frontmatter must be at the top of the Markdown file, and must take the form of valid YAML set between triple-dashed lines. Example: | ||
|
||
```md | ||
--- | ||
title: Docs with VitePress | ||
editLink: true | ||
--- | ||
``` | ||
|
||
Between the triple-dashed lines, you can set [predefined variables](#predefined-variables), or even create custom ones of your own. These variables can be used via the <code>\$page.frontmatter</code> variable. | ||
|
||
Here’s an example of how you could use it in your Markdown file: | ||
|
||
```md | ||
--- | ||
title: Docs with VitePress | ||
editLink: true | ||
--- | ||
|
||
# {{ $page.frontmatter.title }} | ||
|
||
Guide content | ||
``` | ||
|
||
## Alternative frontmatter Formats | ||
|
||
VitePress also supports JSON frontmatter syntax, starting and ending in curly braces: | ||
|
||
```json | ||
--- | ||
{ | ||
"title": "Blogging Like a Hacker", | ||
"editLink": true | ||
} | ||
--- | ||
``` | ||
|
||
## Predefined Variables | ||
|
||
### title | ||
|
||
- Type: `string` | ||
- Default: `h1_title || siteData.title` | ||
|
||
Title of the current page. | ||
|
||
### head | ||
|
||
- Type: `array` | ||
- Default: `undefined` | ||
|
||
Specify extra head tags to be injected: | ||
|
||
```yaml | ||
--- | ||
head: | ||
- - meta | ||
- name: description | ||
content: hello | ||
- - meta | ||
- name: keywords | ||
content: super duper SEO | ||
--- | ||
``` | ||
|
||
### navbar | ||
|
||
- Type: `boolean` | ||
- Default: `undefined` | ||
|
||
You can disable the navbar on a specific page with `navbar: false` | ||
|
||
### sidebar | ||
|
||
- Type: `boolean|'auto'` | ||
- Default: `undefined` | ||
|
||
You can decide to show the sidebar on a specific page with `sidebar: auto` or disable it with `sidebar: false` | ||
|
||
### editLink | ||
|
||
- Type: `boolean` | ||
- Default: `undefined` | ||
|
||
Define if this page should include an edit link. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters