docs: update contributors and changelog

This commit is contained in:
pengzhanbo 2024-12-02 01:11:29 +08:00
parent d31fe6f9dd
commit 5e0cb36a65
3 changed files with 81 additions and 7 deletions

View File

@ -6,7 +6,7 @@ export const theme: Theme = plumeTheme({
hostname: process.env.SITE_HOST || 'https://plume.pengzhanbo.cn',
docsRepo: 'https://github.com/pengzhanbo/vuepress-theme-plume',
docsDir: 'docs',
changelog: true,
changelog: { maxCount: 10 },
contributors: { mode: 'block' },
plugins: {

View File

@ -16,6 +16,24 @@ permalink: /guide/features/changelog/
该功能由 [@vuepress/plugin-git](https://ecosystem.vuejs.press/zh/plugins/development/git.html) 提供支持。
::: warning 注意
该功能由于需要通过 `git log` 命令获取每个 md 文件的提交记录,是一个相对比较耗时的操作,特别是对于大型项目,提交记录数量较多的情况。因此该功能在开发环境中不会启用,仅在生产环境中启用。
但你仍然可以通过设置 `theme.plugins.git``true` 来启用该功能,以便在开发环境中测试。
```ts
import { defineUserConfig } from 'vuepress'
import { plumeTheme } from 'vuepress-theme-plume'
export default defineUserConfig({
theme: plumeTheme({
plugins: { git: true }
})
})
```
:::
## 使用
主题已内置 [@vuepress/plugin-git](https://ecosystem.vuejs.press/zh/plugins/development/git.html) 插件,你无需重新安装即可使用。
@ -45,9 +63,6 @@ export default defineUserConfig({
:::
::: warning 出于性能考虑,主题默认不会在 开发环境中启用该功能,仅在 生产环境中启用。
:::
## 配置
```ts
@ -115,3 +130,23 @@ export default defineUserConfig({
主题默认适配了 `github/gitlab/gitee/bitbucket` git 托管服务的相关访问地址模式。
如果您使用的是内建的托管服务或者其他,请自行配置 `commitUrlPattern``issueUrlPattern``tagUrlPattern`
:::
## 注意
该功能要求你的项目在 [Git 仓库](https://git-scm.com/book/en/Git-Basics-Getting-a-Git-Repository) 下,这样它才能从提交历史记录中收集信息。
**在构建站点时,你应该确保所有的提交记录是可以获取到的。**
举例来说, CI 工作流通常会在克隆你的仓库时添加 `--depth 1` 参数来避免拉取全部的提交记录,因此你需要禁用这个功能,以便该插件在 CI 可以中正常使用。
类似于 `github actions``Netlify``Vercel` 等服务,默认是不会拉取全部的提交记录的。
`github actions` 中,可以通过添加 `--depth 1` 参数来使得 `github actions` 可以正确获取到所有的提交记录。
`Netlify``Vercel` 等服务中,处理方法则会相对复杂一些。这时候您可以先在 `github actions` 完成构建后
输出将产物输出到另一个单独的分支,然后在 `Netlify` 或者 `Vercel` 中直接使用该分支进行部署。
::: info
通过主题的 `cli` 工具创建的项目,在选择部署方式为 `github action` 时,构建产物会输出到 `gh_pages` 分支中,
你可以在此基础上完成 `Netlify` 或者 `Vercel` 的部署。
:::

View File

@ -16,6 +16,24 @@ permalink: /guide/features/contributors/
该功能由 [@vuepress/plugin-git](https://ecosystem.vuejs.press/zh/plugins/development/git.html) 提供支持。
::: warning 注意
该功能由于需要通过 `git log` 命令获取每个 md 文件的提交记录,是一个相对比较耗时的操作,特别是对于大型项目,提交记录数量较多的情况。因此该功能在开发环境中不会启用,仅在生产环境中启用。
但你仍然可以通过设置 `theme.plugins.git``true` 来启用该功能,以便在开发环境中测试。
```ts
import { defineUserConfig } from 'vuepress'
import { plumeTheme } from 'vuepress-theme-plume'
export default defineUserConfig({
theme: plumeTheme({
plugins: { git: true }
})
})
```
:::
## 使用
主题已内置 [@vuepress/plugin-git](https://ecosystem.vuejs.press/zh/plugins/development/git.html) 插件,你无需重新安装即可使用。
@ -45,9 +63,6 @@ export default defineUserConfig({
:::
::: warning 出于性能考虑,主题默认不会在 开发环境中启用该功能,仅在 生产环境中启用。
:::
## 配置
### mode
@ -63,6 +78,9 @@ export default defineUserConfig({
- `block`:在文章内容末尾插入贡献者信息,该模式下包含 贡献者名称、贡献者链接、贡献者头像。
(如当前页面内容结尾所示)
`block` 模式下,贡献者默认均会显示头像,即使您未填写头像地址。插件会从 `https://gravatar.com/`
根据 邮箱地址或用户名 生成头像地址。
```ts
import { defineUserConfig } from 'vuepress'
import { plumeTheme } from 'vuepress-theme-plume'
@ -244,6 +262,7 @@ export default defineUserConfig({
name: string
email: string
commits: number // 贡献者提交次数
avatar?: string
}
```
@ -262,3 +281,23 @@ export default defineUserConfig({
是否显示贡献者信息。
如果您的文章来源于第三方, git 提交不能完整列出所有的作者,您可以在此处补充贡献者。
## 注意
该功能要求你的项目在 [Git 仓库](https://git-scm.com/book/en/Git-Basics-Getting-a-Git-Repository) 下,这样它才能从提交历史记录中收集信息。
**在构建站点时,你应该确保所有的提交记录是可以获取到的。**
举例来说, CI 工作流通常会在克隆你的仓库时添加 `--depth 1` 参数来避免拉取全部的提交记录,因此你需要禁用这个功能,以便该插件在 CI 可以中正常使用。
类似于 `github actions``Netlify``Vercel` 等服务,默认是不会拉取全部的提交记录的。
`github actions` 中,可以通过添加 `--depth 1` 参数来使得 `github actions` 可以正确获取到所有的提交记录。
`Netlify``Vercel` 等服务中,处理方法则会相对复杂一些。这时候您可以先在 `github actions` 完成构建后
输出将产物输出到另一个单独的分支,然后在 `Netlify` 或者 `Vercel` 中直接使用该分支进行部署。
::: info
通过主题的 `cli` 工具创建的项目,在选择部署方式为 `github action` 时,构建产物会输出到 `gh_pages` 分支中,
你可以在此基础上完成 `Netlify` 或者 `Vercel` 的部署。
:::