diff --git a/docs/.vuepress/config.ts b/docs/.vuepress/config.ts index b60b350d..6e42db82 100644 --- a/docs/.vuepress/config.ts +++ b/docs/.vuepress/config.ts @@ -3,8 +3,7 @@ import process from 'node:process' import { viteBundler } from '@vuepress/bundler-vite' import { webpackBundler } from '@vuepress/bundler-webpack' import { defineUserConfig } from '@vuepress/cli' -import themePlume from 'vuepress-theme-plume' -import { enNotes, zhNotes } from './notes.js' +import { theme } from './theme.js' export default defineUserConfig({ base: '/', @@ -14,117 +13,9 @@ export default defineUserConfig({ source: path.resolve(__dirname, '../'), public: path.resolve(__dirname, 'public'), locales: { - '/': { - title: 'Plume主题', - description: '', - lang: 'zh-CN', - }, - '/en/': { - title: 'Plume Theme', - description: '', - lang: 'en', - }, + '/': { title: 'Plume主题', description: '', lang: 'zh-CN' }, + '/en/': { title: 'Plume Theme', description: '', lang: 'en' }, }, - - bundler: - process.env.DOCS_BUNDLER === 'webpack' ? webpackBundler() : viteBundler(), - - theme: themePlume({ - logo: 'https://pengzhanbo.cn/g.gif', - hostname: 'https://pengzhanbo.cn', - repo: 'https://github.com/pengzhanbo/vuepress-theme-plume', - docsDir: 'docs', - editLink: true, - editLinkText: 'Edit this page on GitHub', - appearance: true, - avatar: { - url: '/images/blogger.jpg', - name: 'Plume Theme', - description: 'The Theme for Vuepress 2.0', - }, - social: [{ icon: 'github', link: 'https://github.com/pengzhanbo' }], - notes: zhNotes, - navbar: [ - { text: '首页', link: '/', icon: 'material-symbols:home-outline' }, - { - text: '博客', - link: '/blog/', - icon: 'material-symbols:article-outline', - }, - { - text: 'VuePress', - icon: 'vscode-icons:file-type-vue', - items: [ - { - text: 'theme-plume', - link: '/note/vuepress-theme-plume/', - icon: 'icon-park-outline:theme', - }, - { - text: '插件', - icon: 'mingcute:plugin-2-line', - items: [ - { - text: 'caniuse', - link: '/note/vuepress-plugin/caniuse/', - icon: 'tabler:brand-css3', - }, - { - text: 'netlify-functions', - link: '/note/vuepress-plugin/netlify-functions/', - icon: 'teenyicons:netlify-outline', - }, - ], - }, - ], - }, - { text: '友情链接', link: '/friends/', icon: 'emojione-monotone:roller-coaster' }, - ], - footer: { - copyright: 'Copyright © 2022-present pengzhanbo', - }, - themePlugins: { - markdownEnhance: { katex: true }, - search: { - locales: { - '/': { - placeholder: '搜索', - }, - }, - }, - }, - locales: { - '/': { selectLanguageName: '简体中文', selectLanguageText: '选择语言' }, - '/en/': { - selectLanguageName: 'English', - selectLanguageText: 'Language', - notes: enNotes, - navbar: [ - { text: 'Home', link: '/en/', icon: 'material-symbols:home-outline' }, - { - text: 'Blog', - link: '/en/blog/', - icon: 'material-symbols:article-outline', - }, - { - text: 'VuePress', - icon: 'vscode-icons:file-type-vue', - items: [ - { - text: 'Plugin', - icon: 'mingcute:plugin-2-line', - items: [ - { - text: 'caniuse', - link: '/en/note/vuepress-plugin/caniuse/', - icon: 'tabler:brand-css3', - }, - ], - }, - ], - }, - ], - }, - }, - }), + bundler: process.env.DOCS_BUNDLER === 'webpack' ? webpackBundler() : viteBundler(), + theme, }) diff --git a/docs/.vuepress/navbar.ts b/docs/.vuepress/navbar.ts new file mode 100644 index 00000000..70aec5ae --- /dev/null +++ b/docs/.vuepress/navbar.ts @@ -0,0 +1,64 @@ +import type { NavItem } from 'vuepress-theme-plume' + +export const zhNavbar = [ + { text: '首页', link: '/', icon: 'material-symbols:home-outline' }, + { + text: '博客', + link: '/blog/', + icon: 'material-symbols:article-outline', + }, + { + text: 'VuePress', + icon: 'vscode-icons:file-type-vue', + items: [ + { + text: 'theme-plume', + link: '/note/vuepress-theme-plume/', + icon: 'icon-park-outline:theme', + }, + { + text: '插件', + icon: 'mingcute:plugin-2-line', + items: [ + { + text: 'caniuse', + link: '/note/vuepress-plugin/caniuse/', + icon: 'tabler:brand-css3', + }, + { + text: 'netlify-functions', + link: '/note/vuepress-plugin/netlify-functions/', + icon: 'teenyicons:netlify-outline', + }, + ], + }, + ], + }, + { text: '友情链接', link: '/friends/', icon: 'emojione-monotone:roller-coaster' }, +] as NavItem[] + +export const enNavbar = [ + { text: 'Home', link: '/en/', icon: 'material-symbols:home-outline' }, + { + text: 'Blog', + link: '/en/blog/', + icon: 'material-symbols:article-outline', + }, + { + text: 'VuePress', + icon: 'vscode-icons:file-type-vue', + items: [ + { + text: 'Plugin', + icon: 'mingcute:plugin-2-line', + items: [ + { + text: 'caniuse', + link: '/en/note/vuepress-plugin/caniuse/', + icon: 'tabler:brand-css3', + }, + ], + }, + ], + }, +] as NavItem[] diff --git a/docs/.vuepress/notes.ts b/docs/.vuepress/notes.ts index c12d2afa..174f8d00 100644 --- a/docs/.vuepress/notes.ts +++ b/docs/.vuepress/notes.ts @@ -5,7 +5,6 @@ export const zhNotes = definePlumeNotesConfig({ link: '/note', notes: [ { - text: '', dir: 'vuepress-theme-plume', link: '/vuepress-theme-plume/', sidebar: [ @@ -34,7 +33,6 @@ export const zhNotes = definePlumeNotesConfig({ }, { dir: 'vuepress-plugin', - text: '', link: '/vuepress-plugin/', sidebar: [ 'caniuse/README', @@ -50,12 +48,11 @@ export const zhNotes = definePlumeNotesConfig({ }) export const enNotes = definePlumeNotesConfig({ - dir: 'notes', - link: '/note', + dir: 'en/notes', + link: '/en/note', notes: [ { dir: 'vuepress-plugin', - text: '', link: '/vuepress-plugin/', sidebar: ['caniuse/README'], }, diff --git a/docs/.vuepress/theme.ts b/docs/.vuepress/theme.ts new file mode 100644 index 00000000..cd2552ec --- /dev/null +++ b/docs/.vuepress/theme.ts @@ -0,0 +1,49 @@ +import themePlume from 'vuepress-theme-plume' +import { enNotes, zhNotes } from './notes.js' +import { enNavbar, zhNavbar } from './navbar.js' + +export const theme = themePlume({ + logo: 'https://pengzhanbo.cn/g.gif', + hostname: 'https://pengzhanbo.cn', + repo: 'https://github.com/pengzhanbo/vuepress-theme-plume', + docsDir: 'docs', + editLink: true, + editLinkText: '在 GitHub 编辑此页', + appearance: true, + avatar: { + url: '/images/blogger.jpg', + name: 'Plume Theme', + description: 'The Theme for Vuepress 2.0', + }, + social: [{ icon: 'github', link: 'https://github.com/pengzhanbo' }], + footer: { copyright: 'Copyright © 2022-present pengzhanbo' }, + + locales: { + '/': { + selectLanguageName: '简体中文', + selectLanguageText: '选择语言', + notes: zhNotes, + navbar: zhNavbar, + }, + '/en/': { + selectLanguageName: 'English', + selectLanguageText: 'Language', + editLinkText: 'Edit this page on GitHub', + notes: enNotes, + navbar: enNavbar, + }, + }, + plugins: { + markdownEnhance: { katex: true }, + search: { + locales: { + '/': { + placeholder: '搜索', + }, + '/en/': { + placeholder: 'Search', + }, + }, + }, + }, +})