阅读统计
约 221 字小于 1 分钟
2024-03-06
概述
为每个页面生成字数统计与预计阅读时间。
关联插件: @vuepress/plugin-reading-time
默认配置:
.vuepress/config.ts
import { defineUserConfig } from 'vuepress'
import { plumeTheme } from 'vuepress-theme-plume'
export default defineUserConfig({
theme: plumeTheme({
readingTime: {
wordPerMinute: 300
},
// 也可以通过 plugins.readingTime 配置,但不推荐
plugins: {
readingTime: {}
}
}),
})
配置
wordPerMinute
- 类型:
number
- 默认值:
300
每分钟阅读字数。
locales
- 类型:
ReadingTimePluginLocaleConfig
阅读时间插件的国际化配置。
interface ReadingTimePluginLocaleData {
/**
* 字数模板,模板中 `$word` 会被自动替换为字数
*/
word: string
/**
* 小于一分钟文字
*/
less1Minute: string
/**
* 时间模板
*/
time: string
}
interface ReadingTimePluginLocaleConfig {
[localePath: string]: ReadingTimePluginLocaleData
}
禁用
可以通过配置 readingTime
为 false
禁用该功能。
禁用后,文章页不会显示字数统计与预计阅读时间。
.vuepress/config.ts
import { defineUserConfig } from 'vuepress'
import { plumeTheme } from 'vuepress-theme-plume'
export default defineUserConfig({
theme: plumeTheme({
readingTime: false
}),
})
贡献者
更新日志
2025/4/1 02:23
查看所有更新日志
74dfa
-docs: enable twoslash for code block于0fd6c
-refactor(theme): improve types and flat config (#524)于f0b21
-docs: improve docs (#390)于0c53b
-docs: improve docs (#332)于ca21d
-feat: add support optional icon for file-tree and code-tabs (#216)于43d3e
-chore: tweak于520dc
-style: lint fix于b079a
-docs: update docs于ca097
-docs: lint fix于c56ba
-feat: 全新的文档!于