11import { defineConfig } from "vitepress" ;
22
3- // --- 环境变量检测逻辑 ---
43const isVercel = process . env . VERCEL === "1" ;
5- const isCFPages = process . env . CF_PAGES === "1" ;
6-
4+ const isCFPages = process . env . CF_PAGES === "1" ;
75const isRootDeploy = isVercel || isCFPages ;
86
97const repoUrl = "https://github.com/1024XEngineer/neo-code" ;
10- const docsBase = `${ repoUrl } /blob/main/docs` ;
11-
12- // 核心修改 1:动态基础路径
138const base = isRootDeploy ? "/" : "/neo-code/" ;
149
15- // 👇👇👇 新增这段调试日志 👇👇👇
16- console . log ( "====== VitePress Build Info ======" ) ;
17- console . log ( "VERCEL Env:" , process . env . VERCEL ) ;
18- console . log ( "CF_PAGES Env:" , process . env . CF_PAGES ) ;
19- console . log ( "Final Base Path:" , base ) ;
20- console . log ( "==================================" ) ;
21-
22- // 核心修改 2:动态站点 URL
2310let siteUrl = "https://1024xengineer.github.io/neo-code/" ;
2411if ( isVercel ) {
25- siteUrl = `https://${ process . env . VERCEL_URL || ' neocode-docs.vercel.app' } /` ;
12+ siteUrl = `https://${ process . env . VERCEL_URL || " neocode-docs.vercel.app" } /` ;
2613} else if ( isCFPages ) {
27- siteUrl = "https://neocode-docs.pages.dev/" ;
14+ siteUrl = "https://neocode-docs.pages.dev/" ;
2815}
2916
30- const brandImageUrl = `${ siteUrl } brand/neocode-mark.png` ;
31-
3217export default defineConfig ( {
3318 title : "NeoCode" ,
3419 description : "基于 Go + Bubble Tea 的本地 Coding Agent 用户指南" ,
@@ -40,23 +25,26 @@ export default defineConfig({
4025 cleanUrls : true ,
4126 lastUpdated : true ,
4227 head : [
43- [ "meta " , { name : "theme-color " , content : "#090B1A " } ] ,
44- [ "meta " , { property : "og:title " , content : "NeoCode 用户指南 " } ] ,
28+ [ "link " , { rel : "preconnect " , href : "https://fonts.googleapis.com " } ] ,
29+ [ "link " , { rel : "preconnect " , href : "https://fonts.gstatic.com" , crossorigin : " " } ] ,
4530 [
46- "meta " ,
31+ "link " ,
4732 {
48- property : "og:description " ,
49- content : "围绕真实命令、配置与 Gateway 使用场景整理的 NeoCode 用户指导网站。 " ,
33+ rel : "stylesheet " ,
34+ href : "https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500;600;700&display=swap " ,
5035 } ,
5136 ] ,
52- [ "meta" , { property : "og:type" , content : "website" } ] ,
37+ [ "meta" , { name : "theme-color" , content : "#f7f7f4" } ] ,
38+ [ "meta" , { property : "og:title" , content : "NeoCode 用户指南" } ] ,
5339 [
5440 "meta" ,
5541 {
56- property : "og:image " ,
57- content : brandImageUrl ,
42+ property : "og:description " ,
43+ content : "围绕真实命令、配置与 Gateway 使用场景整理的 NeoCode 用户指导网站。" ,
5844 } ,
5945 ] ,
46+ [ "meta" , { property : "og:type" , content : "website" } ] ,
47+ [ "meta" , { property : "og:image" , content : `${ base } brand/neocode-mark.png` } ] ,
6048 [ "meta" , { name : "twitter:card" , content : "summary" } ] ,
6149 // Favicon 路径随 base 变化
6250 [ "link" , { rel : "icon" , href : `${ base } brand/neocode-mark.png` } ] ,
@@ -81,62 +69,63 @@ export default defineConfig({
8169 link : "/" ,
8270 themeConfig : {
8371 nav : [
84- { text : "开始使用 " , link : "/guide/" } ,
85- { text : "配置 " , link : "/guide/configuration " } ,
86- { text : "命令与会话 " , link : "/guide/quick-start " } ,
72+ { text : "快速开始 " , link : "/guide/" } ,
73+ { text : "日常使用 " , link : "/guide/daily-use " } ,
74+ { text : "排障 " , link : "/guide/troubleshooting " } ,
8775 { text : "Gateway" , link : "/guide/gateway" } ,
88- { text : "深入阅读 " , link : "/reference/" } ,
76+ { text : "进阶与设计 " , link : "/reference/" } ,
8977 { text : "GitHub" , link : repoUrl } ,
9078 ] ,
9179 sidebar : {
9280 "/guide/" : [
9381 {
94- text : "开始使用 " ,
82+ text : "快速开始 " ,
9583 items : [
9684 { text : "总览" , link : "/guide/" } ,
97- { text : "NeoCode 是什么" , link : "/guide/getting-started" } ,
98- { text : "安装与运行" , link : "/guide/install" } ,
99- { text : "首次上手" , link : "/guide/quick-start" } ,
85+ { text : "安装与首次运行" , link : "/guide/install" } ,
86+ { text : "使用示例" , link : "/guide/examples" } ,
10087 ] ,
10188 } ,
10289 {
10390 text : "日常使用" ,
10491 items : [
105- { text : "配置入口" , link : "/guide/configuration" } ,
106- { text : "工作区与会话" , link : "/guide/workspace-session" } ,
107- { text : "记忆与 Skills" , link : "/guide/memo-skills" } ,
108- { text : "Gateway 与 URL Dispatch" , link : "/guide/gateway" } ,
109- { text : "升级与版本检查" , link : "/guide/update" } ,
92+ { text : "日常使用" , link : "/guide/daily-use" } ,
93+ { text : "配置指南" , link : "/guide/configuration" } ,
94+ { text : "工具与权限" , link : "/guide/tools-permissions" } ,
11095 ] ,
11196 } ,
112- ] ,
113- "/reference/" : [
11497 {
115- text : "深入阅读 " ,
98+ text : "扩展能力 " ,
11699 items : [
117- { text : "文档导航" , link : "/reference/" } ,
118- { text : "旧入口兼容页" , link : "/docs/" } ,
100+ { text : "MCP 工具接入" , link : "/guide/mcp" } ,
101+ { text : "Skills 使用" , link : "/guide/skills" } ,
102+ ] ,
103+ } ,
104+ {
105+ text : "质量与协作" ,
106+ items : [
107+ { text : "排障与常见问题" , link : "/guide/troubleshooting" } ,
108+ { text : "Gateway 使用" , link : "/guide/gateway" } ,
109+ { text : "升级与版本检查" , link : "/guide/update" } ,
119110 ] ,
120111 } ,
121112 ] ,
122- "/docs /" : [
113+ "/reference /" : [
123114 {
124- text : "文档入口 " ,
115+ text : "深入阅读 " ,
125116 items : [
126- { text : "总览" , link : "/docs/" } ,
127- { text : "开始使用" , link : "/guide/" } ,
128- { text : "深入阅读" , link : "/reference/" } ,
117+ { text : "文档导航" , link : "/reference/" } ,
129118 ] ,
130119 } ,
131120 ] ,
132121 "/" : [
133122 {
134123 text : "快速导航" ,
135124 items : [
136- { text : "开始使用 " , link : "/guide/" } ,
137- { text : "安装与运行 " , link : "/guide/install" } ,
138- { text : "首次上手 " , link : "/guide/quick-start " } ,
139- { text : "配置入口 " , link : "/guide/configuration " } ,
125+ { text : "快速开始 " , link : "/guide/" } ,
126+ { text : "安装与首次运行 " , link : "/guide/install" } ,
127+ { text : "日常使用 " , link : "/guide/daily-use " } ,
128+ { text : "排障 " , link : "/guide/troubleshooting " } ,
140129 ] ,
141130 } ,
142131 ] ,
@@ -169,18 +158,54 @@ export default defineConfig({
169158 "A compact NeoCode docs entrypoint focused on current, verifiable behavior." ,
170159 themeConfig : {
171160 nav : [
172- { text : "Home" , link : "/en/" } ,
173- { text : "Docs" , link : "/en/docs/" } ,
161+ { text : "Getting Started" , link : "/en/guide/" } ,
162+ { text : "Daily Use" , link : "/en/guide/daily-use" } ,
163+ { text : "Troubleshooting" , link : "/en/guide/troubleshooting" } ,
164+ // Gateway 页面仅有中文版,英文站跨语言指向
165+ { text : "Gateway" , link : "/guide/gateway" } ,
166+ { text : "Reference" , link : "/reference/" } ,
174167 { text : "GitHub" , link : repoUrl } ,
175168 ] ,
176169 sidebar : {
177- "/en/docs/" : [
170+ "/en/guide/" : [
171+ {
172+ text : "Getting Started" ,
173+ items : [
174+ { text : "Getting Started" , link : "/en/guide/" } ,
175+ { text : "Install & First Run" , link : "/en/guide/install" } ,
176+ { text : "Usage Examples" , link : "/en/guide/examples" } ,
177+ ] ,
178+ } ,
179+ {
180+ text : "Daily Use" ,
181+ items : [
182+ { text : "Daily Use" , link : "/en/guide/daily-use" } ,
183+ { text : "Configuration" , link : "/en/guide/configuration" } ,
184+ { text : "Tools & Permissions" , link : "/en/guide/tools-permissions" } ,
185+ ] ,
186+ } ,
187+ {
188+ text : "Extensions" ,
189+ items : [
190+ { text : "MCP Tools" , link : "/en/guide/mcp" } ,
191+ { text : "Skills" , link : "/en/guide/skills" } ,
192+ ] ,
193+ } ,
194+ {
195+ text : "Quality & Ops" ,
196+ items : [
197+ { text : "Troubleshooting" , link : "/en/guide/troubleshooting" } ,
198+ // Gateway 页面仅有中文版,英文站跨语言指向
199+ { text : "Gateway Usage" , link : "/guide/gateway" } ,
200+ { text : "Update & Version" , link : "/en/guide/update" } ,
201+ ] ,
202+ } ,
203+ ] ,
204+ "/reference/" : [
178205 {
179- text : "Overview " ,
206+ text : "Reference " ,
180207 items : [
181- { text : "Docs Index" , link : "/en/docs/" } ,
182- { text : "Chinese Guide" , link : "/guide/" } ,
183- { text : "Architecture Notes" , link : "/reference/" } ,
208+ { text : "Documentation Index" , link : "/reference/" } ,
184209 ] ,
185210 } ,
186211 ] ,
@@ -210,9 +235,5 @@ export default defineConfig({
210235 sitemap : {
211236 hostname : siteUrl ,
212237 } ,
213- vite : {
214- define : {
215- __NEOCODE_DOCS_BASE__ : JSON . stringify ( docsBase ) ,
216- } ,
217- } ,
238+
218239} ) ;
0 commit comments