Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: update blog and notes docs #199

Merged
merged 1 commit into from
Sep 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions docs/notes/theme/config/frontmatter/post.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,45 @@ tags:
- 默认值: `[]`

文章标签。

### cover

- 类型: `string \| BlogPostCover`
- 默认值: `''`

文章封面图。 封面图仅显示在 文章列表页。

当传入为 `string` 时,表示 封面图链接地址。仅支持 绝对路径 以及 远程图片地址。

当传入为 `BlogPostCover` 时,表示 封面图配置。

```ts
interface BlogPostCover {
/**
* 封面图链接地址,只能使用 绝对路径 以及 远程图片地址
*/
url: string
/**
* 博客文章封面图的位置
*/
layout?: 'left' | 'right' | 'odd-left' | 'odd-right' | 'top'
/**
* 博客文章封面图的比例
*
* @default '4:3'
*/
ratio?: number | `${number}:${number}`

/**
* 封面图的宽度, 仅在 layout 为 'left' 或 'right' 时生效
*
* @default 240
*/
width?: number
/**
* 是否使用紧凑模式,紧凑模式下,封面图紧贴容器边缘
* @default false
*/
compact?: boolean
}
```
45 changes: 44 additions & 1 deletion docs/notes/theme/config/主题配置.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,11 @@ interface BlogOptions {

/**
* 分页配置
*
* - `false` - 不启用分页
* - `number` - 每页显示的文章数量
*/
pagination?: false | {
pagination?: false | number | {
/**
* 每页显示的文章数量
* @default 10
Expand All @@ -104,6 +107,46 @@ interface BlogOptions {
* @default true
*/
categories?: boolean

/**
* 博客文章封面图
*
* 配置封面图的位置,支持 `'left'`、`'right'`、`'top'`、`'top-inside'`
*
* @default 'right'
*/
postCover?: BlogPostCoverLayout | Omit<BlogPostCover, 'url'>
}

type BlogPostCoverLayout = 'left' | 'right' | 'odd-left' | 'odd-right' | 'top'

interface BlogPostCover {
/**
* 封面图链接地址,只能使用 绝对路径 以及 远程图片地址
*/
url: string
/**
* 博客文章封面图的位置
*/
layout?: BlogPostCoverLayout
/**
* 博客文章封面图的比例
*
* @default '4:3'
*/
ratio?: number | `${number}:${number}`

/**
* 封面图的宽度, 仅在 layout 为 'left' 或 'right' 时生效
*
* @default 240
*/
width?: number
/**
* 是否使用紧凑模式,紧凑模式下,封面图紧贴容器边缘
* @default false
*/
compact?: boolean
}
```

Expand Down
Loading