From 6f4bbd6d068cfc2ec517b88739607779fcfa3800 Mon Sep 17 00:00:00 2001 From: GeWuYou <95328647+GeWuYou@users.noreply.github.com> Date: Wed, 11 Feb 2026 11:12:05 +0800 Subject: [PATCH] =?UTF-8?q?refactor(docs):=20=E4=BC=98=E5=8C=96=E6=96=87?= =?UTF-8?q?=E6=A1=A3=E7=AB=99=E7=82=B9=E9=85=8D=E7=BD=AE=E5=92=8C404?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E5=AE=9E=E7=8E=B0=E5=A4=9A=E8=AF=AD=E8=A8=80?= =?UTF-8?q?=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 更新VitePress配置移除不必要的服务器中间件 - 实现404页面的中英文国际化显示 - 为404页面添加倒计时自动跳转功能 - 重构404页面样式并添加返回首页按钮 - 优化依赖缓存哈希值更新构建配置 --- docs/.vitepress/cache/deps/_metadata.json | 12 +-- docs/.vitepress/config.mts | 104 +++------------------- docs/404.md | 96 ++++++++++++++------ 3 files changed, 86 insertions(+), 126 deletions(-) diff --git a/docs/.vitepress/cache/deps/_metadata.json b/docs/.vitepress/cache/deps/_metadata.json index 4b1af75..44658bc 100644 --- a/docs/.vitepress/cache/deps/_metadata.json +++ b/docs/.vitepress/cache/deps/_metadata.json @@ -1,25 +1,25 @@ { - "hash": "f04df328", - "configHash": "15e8eca7", + "hash": "74ecdc37", + "configHash": "1c302118", "lockfileHash": "42b6a898", - "browserHash": "342224e2", + "browserHash": "b3e735e5", "optimized": { "vue": { "src": "../../../node_modules/vue/dist/vue.runtime.esm-bundler.js", "file": "vue.js", - "fileHash": "c87f1bc4", + "fileHash": "5c6400c6", "needsInterop": false }, "vitepress > @vue/devtools-api": { "src": "../../../node_modules/@vue/devtools-api/dist/index.js", "file": "vitepress___@vue_devtools-api.js", - "fileHash": "4ddc9988", + "fileHash": "673694b5", "needsInterop": false }, "vitepress > @vueuse/core": { "src": "../../../node_modules/@vueuse/core/dist/index.js", "file": "vitepress___@vueuse_core.js", - "fileHash": "3d4a475e", + "fileHash": "7fde5c45", "needsInterop": false } }, diff --git a/docs/.vitepress/config.mts b/docs/.vitepress/config.mts index a93efd4..e78b637 100644 --- a/docs/.vitepress/config.mts +++ b/docs/.vitepress/config.mts @@ -1,53 +1,19 @@ import { defineConfig } from 'vitepress' export default defineConfig({ - title: "GFramework", - description: "面向游戏开发场景的模块化 C# 框架", - base: "/GFramework/", - vite: { - plugins: [ - { - name: 'catch-all-404', - configureServer(server) { - return () => { - server.middlewares.use((req, res, next) => { - const url = req.url || '' + title: 'GFramework', + description: '面向游戏开发场景的模块化 C# 框架', - // 排除这些路径 - const excludePaths = [ - '/@vite', - '/@fs', - '/node_modules', - '/__vite', - '/public' - ] + /** GitHub Pages / 子路径部署 */ + base: '/GFramework/', - // 如果是资源文件或特殊路径,跳过 - if (excludePaths.some(path => url.startsWith(path)) || - url.includes('.') || - url.startsWith('/GFramework/')) { - return next() - } - - // 其他路径重定向到 404 - res.writeHead(302, { Location: '/GFramework/404' }) - res.end() - }) - } - } - } - ], - server: { - strictPort: false, - // 添加中间件处理不带斜杠的情况 - proxy: {} - } - }, + /** 多语言 */ locales: { root: { label: '简体中文', lang: 'zh-CN', link: '/zh-CN/', + themeConfig: { logo: '/logo-icon.png', @@ -94,6 +60,7 @@ export default defineConfig({ ] } ], + '/zh-CN/core/': [ { text: 'Core 核心框架', @@ -107,6 +74,7 @@ export default defineConfig({ ] } ], + '/zh-CN/game/': [ { text: 'Game 游戏模块', @@ -119,6 +87,7 @@ export default defineConfig({ ] } ], + '/zh-CN/godot/': [ { text: 'Godot 集成', @@ -131,6 +100,7 @@ export default defineConfig({ ] } ], + '/zh-CN/source-generators/': [ { text: '源码生成器', @@ -142,6 +112,7 @@ export default defineConfig({ ] } ], + '/zh-CN/tutorials/': [ { text: '教程', @@ -152,6 +123,7 @@ export default defineConfig({ ] } ], + '/zh-CN/api-reference/': [ { text: 'API 参考', @@ -185,56 +157,6 @@ export default defineConfig({ next: '下一页' } } - }, - - // 未来添加英文版本时取消注释 - /* - en: { - label: 'English', - lang: 'en-US', - link: '/en/', - themeConfig: { - logo: '/logo-icon.png', - - search: { - provider: 'local' - }, - - nav: [ - { text: 'Home', link: '/en/' }, - { text: 'Getting Started', link: '/en/getting-started/installation' }, - { text: 'Core', link: '/en/core/overview' }, - { text: 'Game', link: '/en/game/overview' }, - { text: 'Godot', link: '/en/godot/overview' }, - { text: 'Source Generators', link: '/en/source-generators/overview' }, - { text: 'Tutorials', link: '/en/tutorials/basic-tutorial' }, - { text: 'API Reference', link: '/en/api-reference/core-api' } - ], - - sidebar: { - '/en/getting-started/': [ - { - text: 'Getting Started', - items: [ - { text: 'Installation', link: '/en/getting-started/installation' }, - { text: 'Quick Start', link: '/en/getting-started/quick-start' }, - { text: 'Architecture Overview', link: '/en/getting-started/architecture-overview' } - ] - } - ], - // ... 其他英文侧边栏配置 - }, - - socialLinks: [ - { icon: 'github', link: 'https://github.com/GeWuYou/GFramework' } - ], - - footer: { - message: 'Released under the Apache 2.0 License', - copyright: 'Copyright © 2026 GeWuYou' - } - } } - */ } -}) \ No newline at end of file +}) diff --git a/docs/404.md b/docs/404.md index bfca57e..8da3435 100644 --- a/docs/404.md +++ b/docs/404.md @@ -2,34 +2,37 @@ layout: page --- -
- Auto redirecting in {{ countdown }} seconds
- {{ countdown }} 秒后自动跳转
+
+ {{ countdown }} 秒后自动跳转
+
+
+ Auto redirecting in {{ countdown }} seconds
+