@@ -3,47 +3,29 @@ import { defineConfig } from 'vitepress';
33import path from 'path' ;
44import fs from 'fs' ;
55
6- const { version, name : packageName , author, license } = JSON . parse (
6+ import { defineGhPagesDocConfig } from "sborshik/vitepress/define-gh-pages-doc-config" ;
7+
8+ const pckgJson = JSON . parse (
79 fs . readFileSync (
810 path . resolve ( __dirname , '../../package.json' ) ,
911 { encoding : 'utf-8' } ,
1012 ) ,
1113) ;
1214
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- } ,
15+ export default defineGhPagesDocConfig ( pckgJson , {
16+ createdYear : '2024' ,
3117 themeConfig : {
32- logo : '/logo.png' ,
33- search : {
34- provider : 'local'
35- } ,
3618 nav : [
3719 { text : 'Home' , link : '/' } ,
3820 { text : 'Introduction' , link : '/introduction/getting-started' } ,
3921 {
40- text : `v ${ version } ` ,
22+ text : `${ pckgJson . version } ` ,
4123 items : [
4224 {
4325 items : [
4426 {
45- text : `v ${ version } ` ,
46- link : `https://github.com/${ author } /${ packageName } /releases/tag/v ${ version } ` ,
27+ text : `${ pckgJson . version } ` ,
28+ link : `https://github.com/${ pckgJson . author } /${ pckgJson . name } /releases/tag/${ pckgJson . version } ` ,
4729 } ,
4830 ] ,
4931 } ,
@@ -87,14 +69,5 @@ export default defineConfig({
8769 ] ,
8870 }
8971 ] ,
90-
91- footer : {
92- message : `Released under the ${ license } License.` ,
93- copyright : `Copyright © 2024-PRESENT ${ author } ` ,
94- } ,
95-
96- socialLinks : [
97- { icon : 'github' , link : `https://github.com/${ author } /${ packageName } ` } ,
98- ] ,
9972 } ,
10073} ) ;
0 commit comments