fix(theme): 修复 auto frontmatter 配置

This commit is contained in:
pengzhanbo 2024-07-12 02:32:11 +08:00
parent 1aa96afd07
commit 7769bc888f
2 changed files with 28 additions and 33 deletions

View File

@ -98,10 +98,6 @@
}
}
.vp-doc > h1:first-of-type {
display: none;
}
.vp-doc img {
display: inline-block;
}

View File

@ -194,36 +194,35 @@ export function resolveOptions(
include: '**/{readme,README,index}.md',
frontmatter: {},
},
toArray(localeOptions.blog?.include).length
? {
include: localeOptions.blog?.include,
frontmatter: {
...options.title !== false
? {
title(title: string, { relativePath }) {
if (title)
return title
const basename = path.basename(relativePath || '', '.md')
return basename
},
} as AutoFrontmatterObject
: undefined,
...baseFrontmatter,
...options.permalink !== false
? {
permalink(permalink: string, { relativePath }) {
if (permalink)
return permalink
const locale = resolveLocale(relativePath)
const prefix = withBase(articlePrefix, locale)
{
include: localeOptions.blog?.include ?? ['**/*.md'],
frontmatter: {
...options.title !== false
? {
title(title: string, { relativePath }) {
if (title)
return title
const basename = path.basename(relativePath || '', '.md')
return basename
},
} as AutoFrontmatterObject
: undefined,
...baseFrontmatter,
...options.permalink !== false
? {
permalink(permalink: string, { relativePath }) {
if (permalink)
return permalink
const locale = resolveLocale(relativePath)
const prefix = withBase(articlePrefix, locale)
return normalizePath(`${prefix}/${nanoid()}/`)
},
} as AutoFrontmatterObject
: undefined,
},
},
return normalizePath(`${prefix}/${nanoid()}/`)
},
} as AutoFrontmatterObject
: undefined,
},
}
: '',
{
include: '*',
frontmatter: {