-
+
{{ readingTime.words }}
diff --git a/theme/src/client/composables/contributors.ts b/theme/src/client/composables/contributors.ts
index 7a8c98e7..5eb13266 100644
--- a/theme/src/client/composables/contributors.ts
+++ b/theme/src/client/composables/contributors.ts
@@ -1,20 +1,20 @@
import { computed } from 'vue'
import type { ComputedRef } from 'vue'
-import type { PlumeThemePageData } from '../../shared/index.js'
import { useData } from '../composables/data.js'
+import { toArray } from '../utils/index.js'
-export function useContributors(): ComputedRef<
- null | Required['contributors']
-> {
+export function useContributors(): ComputedRef {
const { theme, page, frontmatter } = useData()
return computed(() => {
- const showContributors
- = frontmatter.value.contributors ?? theme.value.contributors ?? true
+ const config = frontmatter.value.contributors ?? theme.value.contributors ?? true
- if (!showContributors)
- return null
+ if (config === false)
+ return []
- return page.value.git?.contributors ?? null
+ const contributors = config === true ? [] : toArray(config)
+ const gitContributors = (page.value.git?.contributors ?? []).map(({ name }) => name)
+
+ return Array.from(new Set([...gitContributors, ...contributors]))
})
}
diff --git a/theme/src/node/autoFrontmatter/resolveOptions.ts b/theme/src/node/autoFrontmatter/resolveOptions.ts
index 35947d59..3b47f548 100644
--- a/theme/src/node/autoFrontmatter/resolveOptions.ts
+++ b/theme/src/node/autoFrontmatter/resolveOptions.ts
@@ -12,7 +12,6 @@ import type {
} from '../../shared/index.js'
import {
getCurrentDirname,
- getPackage,
nanoid,
normalizePath,
pathJoin,
@@ -24,8 +23,7 @@ export function resolveOptions(
localeOptions: PlumeThemeLocaleOptions,
options: AutoFrontmatter,
): AutoFrontmatter {
- const pkg = getPackage()
- const { locales = {}, article: articlePrefix = '/article/' } = localeOptions
+ const { article: articlePrefix = '/article/' } = localeOptions
const resolveLocale = (relativeFilepath: string) => {
const file = ensureLeadingSlash(relativeFilepath)
@@ -33,11 +31,6 @@ export function resolveOptions(
return resolveLocalePath(localeOptions.locales!, file)
}
- const resolveOptions = (relativeFilepath: string) => {
- const locale = resolveLocale(relativeFilepath)
- return locales[locale] || localeOptions
- }
-
const notesList = resolveNotesOptions(localeOptions)
const localesNotesDirs = uniq(notesList
.flatMap(({ notes, dir }) =>
@@ -46,18 +39,6 @@ export function resolveOptions(
const baseFrontmatter: AutoFrontmatterObject = {}
- if (options.author !== false) {
- baseFrontmatter.author = (author: string, { relativePath }, data) => {
- if (author)
- return author
- if (data.friends || data.pageLayout === 'friends')
- return
- const profile = resolveOptions(relativePath).profile ?? resolveOptions(relativePath).avatar
-
- return profile?.name || pkg.author || ''
- }
- }
-
if (options.createTime !== false) {
baseFrontmatter.createTime = (formatTime: string, { createTime }, data) => {
if (formatTime)
diff --git a/theme/src/node/plugins/getPlugins.ts b/theme/src/node/plugins/getPlugins.ts
index 9bae6cfe..128b608c 100644
--- a/theme/src/node/plugins/getPlugins.ts
+++ b/theme/src/node/plugins/getPlugins.ts
@@ -69,13 +69,13 @@ export function getPlugins({
plugins.push(nprogressPlugin())
}
- if (pluginOptions.git ?? isProd) {
- plugins.push(gitPlugin({
- createdTime: false,
- updatedTime: true,
- contributors: true,
- }))
- }
+ // if (pluginOptions.git ?? isProd) {
+ plugins.push(gitPlugin({
+ createdTime: true,
+ updatedTime: true,
+ contributors: true,
+ }))
+ // }
if (pluginOptions.photoSwipe !== false) {
plugins.push(photoSwipePlugin({
diff --git a/theme/src/shared/auto-frontmatter.ts b/theme/src/shared/auto-frontmatter.ts
index 924a1987..597b8cea 100644
--- a/theme/src/shared/auto-frontmatter.ts
+++ b/theme/src/shared/auto-frontmatter.ts
@@ -51,6 +51,8 @@ export interface AutoFrontmatter {
* 是否自动生成 author
*
* 默认读取 `profile.name` 或 `package.json` 的 `author`
+ *
+ * @deprecated 不再默认生成 `author`, 该配置已废弃
*/
author?: boolean
/**
diff --git a/theme/src/shared/frontmatter/page.ts b/theme/src/shared/frontmatter/page.ts
index 9baaa16e..763422d6 100644
--- a/theme/src/shared/frontmatter/page.ts
+++ b/theme/src/shared/frontmatter/page.ts
@@ -25,7 +25,7 @@ export interface PlumeThemePageFrontmatter extends PlumeNormalFrontmatter {
/**
* 是否显示贡献者
*/
- contributors?: boolean
+ contributors?: boolean | string | string[]
/**
* 上一篇
*/