Page
FrontMatter
You can custom page by front-matter.
TIP
More configuration options can be found in:
- Page configuration: PageFrontmatter
PageFrontmatter Types
ts
import type { ImageObject, NodeRelations } from '@unhead/schema-org'
import type { CollectionConfig } from '../../client/types'
export interface Album {
/**
* @description:en-US Album Link
*/
url: string
/**
* @description:en-US Album cover
* url
*/
cover: string
/**
* @description:en-US Album caption
*/
caption: string
/**
* @description:en-US Album description
*/
desc: string
}
export interface Photo {
src: string
caption: string
desc: string
}
export interface BaseFrontMatter extends Record<string, any> {
/**
* Title
* @description 文章标题
*
* ```md
* ---
* title: Post Title
* ---
* ```
*
* i18n:
*
* ```md
* ---
* title:
* en: Post Title
* zh-CN: 文章标题
* ---
* ```
*/
title: string | Record<string, string>
/**
* @description:en-US Created Date
* @description:zh-CN 文章创建日期
*/
date: string | number | Date
/**
* Updated Time
*/
updated: string | number | Date
}
export interface PageFrontMatter extends BaseFrontMatter {
/**
* Path of post
* route.path
* @description 路径
*/
path: string
/**
* abbrlink
*
* generated by valaxy-addon-abbrlink, do not manually modify
*
* just compatible for [hexo-abbrlink](https://github.com/ohroy/hexo-abbrlink)
*/
abbrlink: string
/**
* i18n
*/
lang: string
/**
* @description Author
* @description:zh-CN 作者
*/
author: string
/**
* Display sponsor info
* @description 是否开启赞助
*/
sponsor: boolean
/**
* Copyright
* @description 是否显示文章底部版权信息
*/
copyright: boolean
/**
* for seo
* schema
*/
image: NodeRelations<ImageObject | string>
/**
* cover
* @description 封面图片
*/
cover: string
/**
* display toc
* @description 是否显示目录
*/
toc: boolean
/**
* display right sidebar
* @description 是否显示右侧侧边栏
*/
aside: boolean
/**
* display left sidebar
* @description 是否显示左侧侧边栏
*/
sidebar: boolean
/**
* @description:en-US Custom Markdown class
* @description:zh-CN 自定义 Markdown 样式
* @default 'markdown-body'
*/
markdownClass: string
/**
* @description:en-US Post title class
* @description:zh-CN 文章标题样式
*/
pageTitleClass: string
/**
* icon before title
* @description 标题前的图标
*/
icon: string
/**
* title color
* @deprecated Please use `pageTitleClass` | `postTitleClass` instead
*/
color: string
/**
* display comment
*/
comment: boolean
/**
* post is end
* @description 是否完结,将在末尾添加衬线字体 Q.E.D.
*/
end: boolean
/**
* Enable/disable KaTeX math rendering for this page.
* Overrides the global `features.katex` setting.
*
* - When `features.katex: true` (default), set `katex: false` to disable KaTeX for this page.
* - When `features.katex: false`, set `katex: true` to enable KaTeX for this page.
*
* @url https://katex.org/
*/
katex: boolean
/**
* use codepen
* @url https://codepen.io/
*/
codepen: boolean
/**
* use medium-zoom
* @url https://github.com/francoischalifour/medium-zoom
*/
medium_zoom: boolean
// --- layout ---
/**
* @description:en-US Albums
* @description:zh-CN 相册
*/
albums: Album[]
/**
* For layout Gallery
* @description:en-US Photos
*/
photos: Photo[]
/**
* for collections
*/
collections: CollectionConfig[]
/**
* @description:zh-CN 是否启用加密,password 存在时默认为 true
*/
encrypt: boolean
/**
* @description:zh-CN 加密密码
*/
password?: string
/**
* @description:zh-CN 密码提示
*/
password_hint?: string
/**
* @description:zh-CN 相册密码
*/
gallery_password?: string
/**
* @en
* @description encrypted content
*
* @description:zh-CN 加密后的内容
*/
encryptedContent?: string
/**
* @description:zh-CN 部分加密的内容
*/
partiallyEncryptedContents?: string[]
/**
* @description:zh-CN 加密后的相册
*/
encryptedPhotos?: string
/**
* @description:en-US Limit the height of the code block in px
* @description:zh-CN 限制代码块的高度,单位是 px
*/
codeHeightLimit?: number
/**
* @description:en-US Source path for client redirection
* @description:zh-CN 客户端重定向的源路径
*/
from?: string | string[]
}titleTemplate
md
---
title: Cool
titleTemplate: '%s - Valaxy'
---You will get html title Cool - Valaxy.
Encrypt Page
WARNING
Encryption relies on the browser’s native Web Crypto API | MDN, It is only available in HTTPS.
ts
import { defineSiteConfig } from 'valaxy'
export default defineSiteConfig({
encrypt: {
// 开启加密,默认关闭
enable: true
// algorithm
// iv
// salt
}
})Add password: YourPassword to the frontmatter of the corresponding page to enable encryption.
When encrypt.enable is true, and the password password exists in the page, encryption is enabled by default.
The encrypted content should be dynamically rendered after decryption. At this time, it cannot (and should not) participate in the build process to generate static artifacts (otherwise it will be seen directly).
md
---
password: valaxy
---Other
sidebar: false: Hide Left Sidebaraside: false: Hide Right Asidetoc: false: Hide TOCcodeHeightLimit: 300: Code block height limit(300px)