General Configuration
About 1149 words
Overview
General Frontmatter configuration applicable to all articles.
Example:
---
title: Title
createTime: 2024/03/02 20:01:09
permalink: /config/frontmatter/basic/
---Configuration
pageLayout
Type:
false | 'home' | 'posts' | 'doc' | 'custom' | 'page' | 'friends' | stringDefault:
docDetails:
Page layout mode.
'home': Homepage layout'posts': Article list page layout'doc': Documentation page layout, including left sidebar, article content, right sidebar, navbar, comments, etc.'page': Includes only the navbar and MD file content. Use this layout for custom page content.'friends': Friends link page layout'custom': Includes only MD file content. Use this layout for fully custom page content.false: Equivalent tocustom
Besides the above values, you can also pass a registered global component name, which will be applied as the layout component. (This form is not included in the source type declarations, but it is supported at runtime.)
In addition,
'blog'has been deprecated; please use'posts'instead.
pageClass
Type:
stringDefault:
''Details:
Additional custom CSS class name for the page.
title
Type:
stringDefault:
''Details:
Article title.
The theme automatically populates the current filename as the article title upon file creation.
badge
- Type:
string | ThemeBadge - Default:
undefined
Display a badge on the right side of the article title.
When a string is passed, it is used as the badge's text; when an object is passed, the following fields are available:
interface ThemeBadge {
/** Badge text content */
text?: string
/** Badge type, used for preset styles */
type?: string
/** Badge text color */
color?: string
/** Badge background color */
bgColor?: string
/** Badge border color */
borderColor?: string
}icon
Type:
ThemeIcon(string | { svg: string })Default:
undefinedDetails:
Used as the icon for the navbar and sidebar.
You can directly use an iconify icon name (loaded automatically). Local and remote SVG icon URLs, or an SVG string passed directly, are also supported.
createTime
Type:
string | falseDefault:
''Details:
Article creation time. When set to
false, the creation time is not displayed on the page.The theme automatically populates the current time as the article creation time upon file creation.
permalink
Type:
stringDefault:
''Details:
Article permanent link.
Upon file creation, the theme automatically populates:
- For blog-type articles:
/article/+8-character random string generated by nanoidas the permanent link. - For articles under the notes directory: The permanent link is automatically populated based on the notes configuration.
- For blog-type articles:
externalLinkIcon
Type:
booleanDefault:
trueDetails:
Whether to display the external link icon for external links within the current article.
backToTop
Type:
booleanDefault:
trueDetails:
Whether to display the back-to-top button for the current article.
comments
Type:
booleanDefault:
trueDetails:
Whether the current article is commentable. Only takes effect when the comment feature is enabled.
sidebar
Type:
string | falseDefault:
undefinedDetails:
Whether to display the left sidebar, or forcibly specify which sidebar the current page displays.
false: Hide the left sidebarstring: Specify the sidebar to display by its key (page path prefix)
aside
Type:
boolean | 'left'Default:
trueDetails:
Whether to display the right sidebar for the current article.
When set to
'left', the right sidebar will be displayed on the left side.
navbar
Type:
booleanDefault:
trueDetails:
Whether to display the navigation bar for the current article.
outline
Type:
false | number | [number, number] | 'deep'Default:
[2, 3]Details:
The heading levels to display.
A single number indicates displaying only headings of that level.
If a tuple is passed, the first number is the minimum level and the second number is the maximum level.
'deep'is the same as[2, 6], which displays all headings from<h2>to<h6>.
Tips
In markdown content, using the attribute syntax {data-outline="level"} / {outline="level"} after a heading allows you to reset the maximum display level for descendant headings under the current heading.
For example:
## Heading 1 {data-outline="5"} <!-- Only affects descendant headings of the current heading -->
### Level 3 Heading
#### Level 4 Heading
##### Level 5 Heading <!-- Level 3, 4, and 5 headings will appear in the sidebar -->
###### Level 6 Heading <!-- This heading will NOT appear in the sidebar -->
## Heading 2 <!-- Headings at the same level are not affected -->
### Level 3 Heading <!-- By default, only up to level 3 headings are shown -->
#### Level 4 Heading <!-- Level 4 headings are not shown -->Note that the value of level should be greater than the level of the current heading; otherwise, it will not take effect.
prev
Type:
string | { text: string, link: string, icon?: string }Default:
''Details:
Customize the previous article for the current article.
- For blog-type articles: The theme automatically populates the title and link of the previous article based on chronological order.
- For notes-type articles: The theme automatically populates the title and link of the previous article based on the note sidebar configuration.
next
Type:
string | { text: string, link: string, icon?: string }Default:
''Details:
Customize the next article for the current article.
- For blog-type articles: The theme automatically populates the title and link of the next article based on chronological order.
- For notes-type articles: The theme automatically populates the title and link of the next article based on the note sidebar configuration.
readingTime
Type:
booleanDefault:
trueDetails:
Whether to display the reading time for the current article.
lastUpdated
Type:
booleanDefault:
trueDetails:
Whether to display the last updated time for the current article. The last updated time is automatically populated based on the git commit time.
contributors
Type:
boolean | string[]Default:
trueDetails:
Whether to display contributors for the current article. Contributors are automatically populated based on git committers.
If your article originates from a third party and git commits cannot fully list all authors, you can supplement contributors here.
For additional information, please refer to contributors.
changelog
Type:
booleanDefault:
falseDetails:
Whether to display the page change history for the current page.
copyright
Type:
boolean | CopyrightLicense | CopyrightFrontmatterDefault:
falseDetails:
Whether to display copyright information for the current article.
For complete information, please refer to copyright.
editLink
Type:
booleanDefault:
trueDetails:
Whether to display the article edit button for the current article.
editLinkPattern
Type:
stringDefault:
''Details:
The edit link pattern for the current page, which overrides
editLinkPatternin the theme configuration.Example:
':repo/edit/:branch/:path'
watermark
Type:
boolean | WatermarkOptionsDefault:
undefined(When the theme does not enable watermarks, or when global watermarks are not enabled, the default value isfalse. If global watermarks are enabled, the default istrue.)Details: Configure the watermark for the current article.
When the type is boolean, it indicates whether to enable the watermark.
When the type is WatermarkOptions, it represents the watermark configuration for the current page.
You can refer to watermark-js-plus.
footer
Type:
booleanDefault:
trueDetails:
Whether to display the footer for the current article.
Contributors
Changelog
e4dae-docs: improve docs (#1071)on0daf2-docs: improve docs (#929)onfc367-feat(theme): add support for{data-outline="level"}attribute syntax for headings, close #757 (#759)onddb77-feat(theme): addfooterfrontmatteron38505-docs: update en docs (#708)on4d236-feat(theme)!: add collections support (#704)on0fd6c-refactor(theme): improve types and flat config (#524)ona4ac3-docs: add en-US docs (#514)on
