docs: 调整 docs 示例配置

This commit is contained in:
pengzhanbo 2024-01-05 01:38:09 +08:00
parent 5ff9570018
commit dc7474fcd7
4 changed files with 120 additions and 119 deletions

View File

@ -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,
})

64
docs/.vuepress/navbar.ts Normal file
View File

@ -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[]

View File

@ -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'],
},

49
docs/.vuepress/theme.ts Normal file
View File

@ -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',
},
},
},
},
})