Skip to content

Commit 03c04b1

Browse files
committed
docs(theme-default): add frontmatter reference
1 parent 9cf2d28 commit 03c04b1

File tree

2 files changed

+501
-2
lines changed

2 files changed

+501
-2
lines changed
Lines changed: 250 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,252 @@
11
# Frontmatter
22

3-
> TODO
3+
## Home Page
4+
5+
Frontmatter in this section will only take effect in home pages.
6+
7+
### home
8+
9+
- Type: `boolean`
10+
11+
- Details:
12+
13+
Specify whether the page is homepage or a normal page.
14+
15+
If you don't set this frontmatter or set it to `false`, the page would be a [normal page](#normal-page).
16+
17+
- Example:
18+
19+
```md
20+
---
21+
home: true
22+
---
23+
```
24+
25+
### heroImage
26+
27+
- Type: `string`
28+
29+
- Details:
30+
31+
Specify the url of the hero image.
32+
33+
- Example:
34+
35+
```md
36+
---
37+
# public file path
38+
heroImage: /hero.png
39+
# url
40+
heroImage: https://vuejs.org/images/logo.png
41+
---
42+
```
43+
44+
- Also see:
45+
- [Guide > Assets > Public Files](../../guide/assets.md#public-files)
46+
47+
### heroAlt
48+
49+
- Type: `string`
50+
51+
- Details:
52+
53+
Specify the `alt` attribute of the hero image.
54+
55+
This will fallback to the [heroText](#heroText).
56+
57+
### heroText
58+
59+
- Type: `string | null`
60+
61+
- Details:
62+
63+
Specify the the hero text.
64+
65+
This will fallback to the site [title](../config.md#title).
66+
67+
Set to `null` to disable hero text.
68+
69+
### tagline
70+
71+
- Type: `string | null`
72+
73+
- Details:
74+
75+
Specify the the tagline.
76+
77+
This will fallback to the site [description](../config.md#description).
78+
79+
Set to `null` to disable tagline.
80+
81+
### actions
82+
83+
- Type:
84+
85+
```ts
86+
Array<{
87+
text: string
88+
link: string
89+
type?: 'primary' | 'secondary'
90+
}>
91+
```
92+
93+
- Details:
94+
95+
Configuration of the action buttons.
96+
97+
- Example:
98+
99+
```md
100+
---
101+
actions:
102+
- text: Get Started
103+
link: /guide/getting-started.html
104+
type: primary
105+
- text: Introduction
106+
link: /guide/
107+
type: secondary
108+
---
109+
```
110+
111+
### features
112+
113+
- Type:
114+
115+
```ts
116+
Array<{
117+
title: string
118+
details: string
119+
}>
120+
```
121+
122+
- Details:
123+
124+
Configuration of the features list.
125+
126+
- Example:
127+
128+
```md
129+
---
130+
features:
131+
- title: Simplicity First
132+
details: Minimal setup with markdown-centered project structure helps you focus on writing.
133+
- title: Vue-Powered
134+
details: Enjoy the dev experience of Vue, use Vue components in markdown, and develop custom themes with Vue.
135+
- title: Performant
136+
details: VuePress generates pre-rendered static HTML for each page, and runs as an SPA once a page is loaded.
137+
---
138+
```
139+
140+
### footer
141+
142+
- Type: `string`
143+
144+
- Details:
145+
146+
Specify the content of the footer.
147+
148+
### footerHtml
149+
150+
- Type: `boolean`
151+
152+
- Details:
153+
154+
Allow HTML in footer or not.
155+
156+
If you set it to `true`, the [footer](#footer) will be treated as HTML code.
157+
158+
## Normal Page
159+
160+
Frontmatter in this section will only take effect in normal pages.
161+
162+
### editLink
163+
164+
- Type: `boolean`
165+
166+
- Details:
167+
168+
Enable the _edit this page_ link in this page or not.
169+
170+
- Also see:
171+
- [Default Theme > Config > editLink](./config.md#editlink)
172+
173+
### lastUpdated
174+
175+
- Type: `boolean`
176+
177+
- Details:
178+
179+
Enable the _last updated timestamp_ in this page or not.
180+
181+
- Also see:
182+
- [Default Theme > Config > lastUpdated](./config.md#lastupdated)
183+
184+
### contributors
185+
186+
- Type: `boolean`
187+
188+
- Details:
189+
190+
Enable the _contributors list_ in this page or not.
191+
192+
- Also see:
193+
- [Default Theme > Config > contributors](./config.md#contributors)
194+
### sidebar
195+
196+
- Type: `false | 'auto' | SidebarConfigArray | SidebarConfigObject`
197+
198+
- Details:
199+
200+
Configure the sidebar of this page.
201+
202+
- Also see:
203+
- [Default Theme > Config > sidebar](./config.md#sidebar)
204+
205+
### prev
206+
207+
- Type: `NavLink | string`
208+
209+
- Details:
210+
211+
Specify the link of the previous page.
212+
213+
If you don't set this frontmatter, the link will be inferred from the sidebar config.
214+
215+
To configure the prev link manually, you can set this frontmatter to a `NavLink` object or a string:
216+
217+
- A `NavLink` object should have a `text` field and a `link` field.
218+
- A string should be the path to the target page file. It will be converted to a `NavLink` object, whose `text` is the page title, and `link` is the page route path.
219+
220+
- Example:
221+
222+
```md
223+
---
224+
# NavLink
225+
prev:
226+
text: Get Started
227+
link: /guide/getting-started.html
228+
229+
# NavLink - external url
230+
prev:
231+
text: GitHub
232+
link: https://github.com
233+
234+
# string - page file path
235+
prev: /guide/getting-started.md
236+
237+
# string - page file relative path
238+
prev: ../../guide/getting-started.md
239+
---
240+
```
241+
242+
### next
243+
244+
- Type: `NavLink | string`
245+
246+
- Details:
247+
248+
Specify the link of the next page.
249+
250+
If you don't set this frontmatter, the link will be inferred from the sidebar config.
251+
252+
The type is the same as [prev](#prev) frontmatter.

0 commit comments

Comments
 (0)