1+ import fs from 'fs'
2+ import path from 'path'
3+ import { defineConfigWithTheme , type HeadConfig , type Plugin } from 'vitepress'
14import type { Config as ThemeConfig } from '@vue/theme'
5+ import llmstxt from 'vitepress-plugin-llms'
26import baseConfig from '@vue/theme/config'
37import { defineConfigWithTheme } from 'vitepress'
48import fs from 'fs'
59import { headerPlugin } from './headerMdPlugin'
610import path from 'path'
711// import { textAdPlugin } from './textAdMdPlugin'
12+ import { groupIconMdPlugin , groupIconVitePlugin } from 'vitepress-plugin-group-icons'
813
914const nav : ThemeConfig [ 'nav' ] = [
1015 {
@@ -181,15 +186,15 @@ export const sidebar: ThemeConfig['sidebar'] = {
181186 link : '/guide/essentials/event-handling'
182187 } ,
183188 { text : '表單輸入綁定' , link : '/guide/essentials/forms' } ,
184- {
185- text : '生命週期' ,
186- link : '/guide/essentials/lifecycle'
187- } ,
188189 { text : '偵聽器' , link : '/guide/essentials/watchers' } ,
189190 { text : '模板引用' , link : '/guide/essentials/template-refs' } ,
190191 {
191192 text : '組件基礎' ,
192193 link : '/guide/essentials/component-basics'
194+ } ,
195+ {
196+ text : 'Lifecycle Hooks' ,
197+ link : '/guide/essentials/lifecycle'
193198 }
194199 ]
195200 } ,
@@ -496,10 +501,6 @@ export const sidebar: ThemeConfig['sidebar'] = {
496501 text : '帶過渡動畫的列表' ,
497502 link : '/examples/#list-transition'
498503 } ,
499- {
500- text : 'TodoMVC' ,
501- link : '/examples/#todomvc'
502- }
503504 ]
504505 } ,
505506 {
@@ -566,38 +567,19 @@ export const sidebar: ThemeConfig['sidebar'] = {
566567 ]
567568}
568569
569- const i18n : ThemeConfig [ 'i18n' ] = {
570- search : '搜索' ,
571- menu : '菜單' ,
572- toc : '本頁目錄' ,
573- returnToTop : '返回頂部' ,
574- appearance : '外觀' ,
575- previous : '前一篇' ,
576- next : '下一篇' ,
577- pageNotFound : '頁面未找到' ,
578- deadLink : {
579- before : '你打開了一個不存在的鏈接:' ,
580- after : '。'
581- } ,
582- deadLinkReport : {
583- before : '不介意的話請提交到' ,
584- link : '這裡' ,
585- after : ',我們會跟進修復。'
586- } ,
587- footerLicense : {
588- before : '' ,
589- after : ''
590- } ,
591- ariaAnnouncer : {
592- before : '' ,
593- after : '已經加載完畢'
594- } ,
595- ariaDarkMode : '切換深色模式' ,
596- ariaSkipToContent : '直接跳到內容' ,
597- ariaToC : '當前頁面的目錄' ,
598- ariaMainNav : '主導航' ,
599- ariaMobileNav : '移動版導航' ,
600- ariaSidebarNav : '側邊欄導航'
570+ // Placeholder of the i18n config for @vuejs -translations.
571+ // const i18n: ThemeConfig['i18n'] = {
572+ // }
573+
574+ function inlineScript ( file : string ) : HeadConfig {
575+ return [
576+ 'script' ,
577+ { } ,
578+ fs . readFileSync (
579+ path . resolve ( __dirname , `./inlined-scripts/${ file } ` ) ,
580+ 'utf-8'
581+ )
582+ ]
601583}
602584
603585export default defineConfigWithTheme < ThemeConfig > ( {
@@ -638,25 +620,11 @@ export default defineConfigWithTheme<ThemeConfig>({
638620 'link' ,
639621 {
640622 rel : 'preconnect' ,
641- href : 'https://sponsors .vuejs.org'
623+ href : 'https://automation .vuejs.org'
642624 }
643625 ] ,
644- [
645- 'script' ,
646- { } ,
647- fs . readFileSync (
648- path . resolve ( __dirname , './inlined-scripts/restorePreference.js' ) ,
649- 'utf-8'
650- )
651- ] ,
652- [
653- 'script' ,
654- { } ,
655- fs . readFileSync (
656- path . resolve ( __dirname , './inlined-scripts/uwu.js' ) ,
657- 'utf-8'
658- )
659- ] ,
626+ inlineScript ( 'restorePreference.js' ) ,
627+ inlineScript ( 'uwu.js' ) ,
660628 [
661629 'script' ,
662630 {
@@ -672,7 +640,8 @@ export default defineConfigWithTheme<ThemeConfig>({
672640 src : 'https://vueschool.io/banner.js?affiliate=vuejs&type=top' ,
673641 async : 'true'
674642 }
675- ]
643+ ] ,
644+ inlineScript ( 'perfops.js' )
676645 ] ,
677646
678647 themeConfig : {
@@ -688,7 +657,7 @@ export default defineConfigWithTheme<ThemeConfig>({
688657 } ,
689658 {
690659 link : 'https://cn.vuejs.org' ,
691- text : '简体中文 ' ,
660+ text : '簡體中文 ' ,
692661 repo : 'https://github.com/vuejs-translations/docs-zh-cn'
693662 } ,
694663 {
@@ -734,7 +703,7 @@ export default defineConfigWithTheme<ThemeConfig>({
734703 {
735704 link : 'https://ru.vuejs.org' ,
736705 text : 'Русский' ,
737- repo : 'https://github.com/translation-gang /docs-ru'
706+ repo : 'https://github.com/vuejs-translations /docs-ru'
738707 } ,
739708 {
740709 link : 'https://cs.vuejs.org' ,
@@ -746,6 +715,11 @@ export default defineConfigWithTheme<ThemeConfig>({
746715 text : '繁體中文' ,
747716 repo : 'https://github.com/vuejs-translations/docs-zh-hk'
748717 } ,
718+ {
719+ link : 'https://pl.vuejs.org' ,
720+ text : 'Polski' ,
721+ repo : 'https://github.com/vuejs-translations/docs-pl' ,
722+ } ,
749723 {
750724 link : '/translations/' ,
751725 text : '幫助我們翻譯!' ,
@@ -830,6 +804,7 @@ export default defineConfigWithTheme<ThemeConfig>({
830804 theme : 'github-dark' ,
831805 config ( md ) {
832806 md . use ( headerPlugin )
807+ . use ( groupIconMdPlugin )
833808 // .use(textAdPlugin)
834809 }
835810 } ,
@@ -858,6 +833,36 @@ export default defineConfigWithTheme<ThemeConfig>({
858833 } ,
859834 json : {
860835 stringify : true
861- }
836+ } ,
837+ plugins : [
838+ llmstxt ( {
839+ ignoreFiles : [
840+ 'about/team/**/*' ,
841+ 'about/team.md' ,
842+ 'about/privacy.md' ,
843+ 'about/coc.md' ,
844+ 'developers/**/*' ,
845+ 'ecosystem/themes.md' ,
846+ 'examples/**/*' ,
847+ 'partners/**/*' ,
848+ 'sponsor/**/*' ,
849+ 'index.md'
850+ ] ,
851+ customLLMsTxtTemplate : `\
852+ # Vue.js
853+
854+ Vue.js - The Progressive JavaScript Framework
855+
856+ ## Table of Contents
857+
858+ {toc}`
859+ } ) as Plugin ,
860+ groupIconVitePlugin ( {
861+ customIcon : {
862+ cypress : 'vscode-icons:file-type-cypress' ,
863+ 'testing library' : 'logos:testing-library'
864+ }
865+ } ) as Plugin
866+ ]
862867 }
863868} )
0 commit comments