页脚
当 themeConfig.footer
存在时,VitePress 将在全局页面底部显示页脚。
js
export default {
themeConfig: {
footer: {
message: 'Released under the MIT License.',
copyright: 'Copyright © 2019-present Evan You'
}
}
}
1
2
3
4
5
6
7
8
2
3
4
5
6
7
8
ts
export interface Footer {
// 在版权信息之前显示的消息
message?: string
// 实际的版权文本
copyright?: string
}
1
2
3
4
5
6
7
2
3
4
5
6
7
上述配置还支持 HTML 字符串。因此,例如,如果你需要配置页脚文本以包含一些链接,你可以调整配置如下:
js
export default {
themeConfig: {
footer: {
message: 'Released under the <a href="https://github.com/vuejs/vitepress/blob/main/LICENSE">MIT License</a>.',
copyright: 'Copyright © 2019-present <a href="https://github.com/yyx990803">Evan You</a>'
}
}
}
1
2
3
4
5
6
7
8
2
3
4
5
6
7
8
警告
只有内联元素可以在 message
和 copyright
中使用,因为它们在 p
元素内呈现。如果你想添加块元素,请考虑使用 layout-bottom
插槽。
请注意,当侧边栏可见时,不会显示页脚。
Frontmatter 配置
可以使用 frontmatter 上的 footer
选项在每个页面上禁用页脚:
yaml
---
footer: false
---
1
2
3
2
3