|
1 | | -import { defineConfig } from 'vitepress'; |
| 1 | +import { defineGhPagesDocConfig } from "sborshik/vitepress/define-gh-pages-doc-config"; |
2 | 2 |
|
3 | 3 | import path from 'path'; |
4 | 4 | import fs from 'fs'; |
5 | 5 |
|
6 | | -const { version, name: packageName, author, license } = JSON.parse( |
| 6 | +const pckgJson = JSON.parse( |
7 | 7 | fs.readFileSync( |
8 | 8 | path.resolve(__dirname, '../../package.json'), |
9 | 9 | { encoding: 'utf-8' }, |
10 | 10 | ), |
11 | 11 | ); |
12 | 12 |
|
13 | | -export default defineConfig({ |
14 | | - title: packageName.replace(/-/g, ' '), |
15 | | - description: `${packageName.replace(/-/g, ' ')} documentation`, |
16 | | - base: `/${packageName}/`, |
17 | | - lastUpdated: true, |
18 | | - head: [ |
19 | | - ['link', { rel: 'icon', href: `/${packageName}/logo.png` }], |
20 | | - ], |
21 | | - transformHead: ({ pageData, head }) => { |
22 | | - head.push(['meta', { property: 'og:site_name', content: packageName }]); |
23 | | - head.push(['meta', { property: 'og:title', content: pageData.title }]); |
24 | | - if (pageData.description) { |
25 | | - head.push(['meta', { property: 'og:description', content: pageData.description }]); |
26 | | - } |
27 | | - head.push(['meta', { property: 'og:image', content: `https://${author}.github.io/${packageName}/logo.png` }]); |
28 | | - |
29 | | - return head |
30 | | - }, |
| 13 | +export default defineGhPagesDocConfig(pckgJson, { |
| 14 | + createdYear:'2025', |
31 | 15 | themeConfig: { |
32 | | - logo: '/logo.png', |
33 | | - search: { |
34 | | - provider: 'local' |
35 | | - }, |
36 | 16 | nav: [ |
37 | 17 | { text: 'Home', link: '/' }, |
38 | 18 | { text: 'Introduction', link: '/introduction/getting-started' }, |
39 | 19 | { |
40 | | - text: `v${version}`, |
| 20 | + text: `${pckgJson.version}`, |
41 | 21 | items: [ |
42 | 22 | { |
43 | 23 | items: [ |
44 | 24 | { |
45 | | - text: `v${version}`, |
46 | | - link: `https://github.com/${author}/${packageName}/releases/tag/v${version}`, |
| 25 | + text: `${pckgJson.version}`, |
| 26 | + link: `https://github.com/${pckgJson.author}/${pckgJson.name}/releases/tag/${pckgJson.version}`, |
47 | 27 | }, |
48 | 28 | ], |
49 | 29 | }, |
@@ -95,14 +75,5 @@ export default defineConfig({ |
95 | 75 | ], |
96 | 76 | } |
97 | 77 | ], |
98 | | - |
99 | | - footer: { |
100 | | - message: `Released under the ${license} License.`, |
101 | | - copyright: `Copyright © 2025-PRESENT ${author}`, |
102 | | - }, |
103 | | - |
104 | | - socialLinks: [ |
105 | | - { icon: 'github', link: `https://github.com/${author}/${packageName}` }, |
106 | | - ], |
107 | 78 | }, |
108 | 79 | }); |
0 commit comments