diff --git a/docs/.vuepress/config.ts b/docs/.vuepress/config.ts
index 99834511..6de923a1 100644
--- a/docs/.vuepress/config.ts
+++ b/docs/.vuepress/config.ts
@@ -26,16 +26,6 @@ export default defineUserConfig({
description: 'The Theme for Vuepress 2.0',
},
social: [{ icon: 'github', link: 'https://github.com/pengzhanbo' }],
- // {
- // email: 'volodymyr@foxmail.com',
- // github: 'pengzhanbo',
- // QQ: '942450674',
- // weiBo: 'https://weibo.com',
- // zhiHu: 'https://zhihu.com',
- // facebook: 'https://baidu.com',
- // twitter: 'https://baidu.com',
- // linkedin: 'https://baidu.com',
- // },
notes,
navbar: [
{ text: 'Blog', link: '/blog/', activeMatch: '/blog/' },
@@ -58,7 +48,6 @@ export default defineUserConfig({
],
footer: {
copyright: 'Copyright © 2022-present pengzhanbo',
- message: '',
},
themePlugins: {
search: {
@@ -68,6 +57,17 @@ export default defineUserConfig({
},
},
},
+ comment: {
+ provider: 'Giscus',
+ comment: true,
+ repo: 'pengzhanbo/pengzhanbo-blog-vuepress',
+ repoId: 'MDEwOlJlcG9zaXRvcnkxNDgwMzY4MDc=',
+ category: 'Announcements',
+ categoryId: 'DIC_kwDOCNLcx84COcVd',
+ mapping: 'pathname',
+ reactionsEnabled: true,
+ inputPosition: 'top',
+ },
},
}),
})
diff --git a/packages/theme/src/client/components/Nav/NavBarTitle.vue b/packages/theme/src/client/components/Nav/NavBarTitle.vue
index b1025613..7c3835bf 100644
--- a/packages/theme/src/client/components/Nav/NavBarTitle.vue
+++ b/packages/theme/src/client/components/Nav/NavBarTitle.vue
@@ -16,7 +16,7 @@ const { hasSidebar } = useSidebar()
{{ site.title }}
diff --git a/packages/theme/src/client/components/icons/IconClock.vue b/packages/theme/src/client/components/icons/IconClock.vue
index 586e1db0..31b54da5 100644
--- a/packages/theme/src/client/components/icons/IconClock.vue
+++ b/packages/theme/src/client/components/icons/IconClock.vue
@@ -1,11 +1,8 @@
-
diff --git a/packages/theme/src/client/utils/shared.ts b/packages/theme/src/client/utils/shared.ts
index c7802c81..c90f23c0 100644
--- a/packages/theme/src/client/utils/shared.ts
+++ b/packages/theme/src/client/utils/shared.ts
@@ -15,7 +15,7 @@ export function isActive(
return false
}
- currentPath = normalize(`/${currentPath}`)
+ currentPath = normalize(`/${currentPath.replace(/^\//, '')}`)
if (asRegex) {
return new RegExp(matchPath).test(currentPath)
diff --git a/packages/theme/src/node/plugins.ts b/packages/theme/src/node/plugins.ts
index 420b8922..ce4a7a9d 100644
--- a/packages/theme/src/node/plugins.ts
+++ b/packages/theme/src/node/plugins.ts
@@ -50,9 +50,11 @@ export const setupPlugins = (
}),
autoFrontmatterPlugin(autoFrontmatter(app, localeOptions)),
blogDataPlugin({
- include: ['**/*.md'],
+ include: localeOptions.blog?.include,
exclude: [
- '**/{README,index}.md',
+ '**/{README,readme,index}.md',
+ '.vuepress/',
+ ...(localeOptions.blog?.exclude || []),
notesDir ? `${notesDir}/**` : '',
].filter(Boolean),
sortBy: 'createTime',
@@ -88,7 +90,7 @@ export const setupPlugins = (
? mediumZoomPlugin({
selector: '.plume-content > img, .plume-content :not(a) > img',
zoomOptions: {
- background: 'var(--c-bg)',
+ background: 'var(--vp-c-bg)',
},
delay: 300,
})
@@ -122,9 +124,10 @@ export const setupPlugins = (
? docsearchPlugin(options.docsearch!)
: [],
options.prismjs !== false && !isProd ? prismjsPlugin() : [],
- options.prismjs !== false && isProd
+ options.shiki !== false && isProd
? shikiPlugin({
theme: 'material-palenight',
+ ...options.shiki,
})
: [],
options.copyCode !== false
diff --git a/packages/theme/src/node/setupPages.ts b/packages/theme/src/node/setupPages.ts
index d45bc209..c616467f 100644
--- a/packages/theme/src/node/setupPages.ts
+++ b/packages/theme/src/node/setupPages.ts
@@ -6,9 +6,12 @@ import type {
PlumeThemePageData,
} from '../shared/index.js'
-export async function setupPage(app: App) {
+export async function setupPage(
+ app: App,
+ localeOption: PlumeThemeLocaleOptions
+) {
const blogPage = await createPage(app, {
- path: '/blog/',
+ path: localeOption.blog?.link,
})
const productPage = await createPage(app, {
path: '/product/',
diff --git a/packages/theme/src/node/theme.ts b/packages/theme/src/node/theme.ts
index d6bfaf6e..f461018d 100644
--- a/packages/theme/src/node/theme.ts
+++ b/packages/theme/src/node/theme.ts
@@ -30,10 +30,13 @@ export const plumeTheme = ({
clientConfigFile: path.resolve(__dirname, '../client/config.js'),
plugins: setupPlugins(app, themePlugins, localeOptions),
onInitialized: async (app) => {
- await setupPage(app)
+ await setupPage(app, localeOptions)
},
extendsPage: (page: Page) => {
- if (page.path === '/blog/') {
+ if (
+ localeOptions.blog?.link &&
+ page.path.startsWith(localeOptions.blog.link)
+ ) {
page.data.type = 'blog'
}
if (page.path === '/product/') {
diff --git a/packages/theme/src/shared/options/index.ts b/packages/theme/src/shared/options/index.ts
index 4bba3d83..28680523 100644
--- a/packages/theme/src/shared/options/index.ts
+++ b/packages/theme/src/shared/options/index.ts
@@ -7,38 +7,6 @@ export interface PlumeThemeOptions extends PlumeThemeLocaleOptions {
* 对主题内部使用的插件进行配置
*/
themePlugins?: PlumeThemePluginOptions
-
- /**
- * 是否仅使用博客功能
- *
- * @default false
- */
- onlyBlog?: boolean
-
- blog?: {
- /**
- * blog 文章读取目录
- *
- * @default './' 即 vuepress 配置的 source 目录
- */
- dir?: string
-
- /**
- * 在 `blog.dir` 目录中,通过 glob string 配置包含文件
- *
- * @default - ['**\*.md']
- */
- include?: string[]
-
- /**
- * 在 `blog.dir` 目录中,通过 glob string 配置排除的文件
- *
- * _README.md 文件一般作为主页或者某个目录下的主页,不应该被读取为 blog文章_
- *
- * @default - ['.vuepress/', 'node_modules/', '{README,index}.md']
- */
- exclude?: string[]
- }
}
export type PlumeThemeLocaleOptions = PlumeThemeData
diff --git a/packages/theme/src/shared/options/plugins.ts b/packages/theme/src/shared/options/plugins.ts
index 2e860bae..102a313d 100644
--- a/packages/theme/src/shared/options/plugins.ts
+++ b/packages/theme/src/shared/options/plugins.ts
@@ -3,6 +3,7 @@ import type { CanIUsePluginOptions } from '@vuepress-plume/vuepress-plugin-caniu
import type { CopyCodeOptions } from '@vuepress-plume/vuepress-plugin-copy-code'
import type { DocsearchOptions } from '@vuepress/plugin-docsearch'
import type { SearchPluginOptions } from '@vuepress/plugin-search'
+import type { ShikiPluginOptions } from '@vuepress/plugin-shiki'
import type { CommentOptions } from 'vuepress-plugin-comment2'
import type { MarkdownEnhanceOptions } from 'vuepress-plugin-md-enhance'
@@ -29,6 +30,8 @@ export interface PlumeThemePluginOptions {
prismjs?: false
+ shiki?: false | ShikiPluginOptions
+
git?: false
nprogress?: false