Merge pull request #194 from GeWuYou/feat/docs-init-vitepress-config

feat(docs): 初始化 GFramework 文档网站配置
This commit is contained in:
gewuyou 2026-04-07 14:34:30 +08:00 committed by GitHub
commit 3109beaa9b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 72 additions and 24 deletions

View File

@ -1,5 +1,26 @@
import { defineConfig } from 'vitepress'
const localSearch = {
provider: 'local' as const,
options: {
translations: {
button: {
buttonText: '搜索',
buttonAriaLabel: '搜索文档'
},
modal: {
noResultsText: '无法找到相关结果',
resetButtonTitle: '清除查询条件',
footer: {
selectText: '选择',
navigateText: '切换',
closeText: '关闭'
}
}
}
}
}
function safeGenericEscapePlugin() {
return {
name: 'safe-generic-escape',
@ -62,6 +83,10 @@ export default defineConfig({
chunkSizeWarningLimit: 1000
}
},
themeConfig: {
// 在顶层保留搜索配置,避免构建期只读取站点级配置时把搜索入口裁掉。
search: localSearch
},
/** 多语言 */
locales: {
root: {
@ -71,41 +96,21 @@ export default defineConfig({
themeConfig: {
logo: '/logo-icon.png',
search: {
provider: 'local',
options: {
translations: {
button: {
buttonText: '搜索文档',
buttonAriaLabel: '搜索文档'
},
modal: {
noResultsText: '无法找到相关结果',
resetButtonTitle: '清除查询条件',
footer: {
selectText: '选择',
navigateText: '切换',
closeText: '关闭'
}
}
}
}
},
search: localSearch,
nav: [
{ text: '首页', link: '/zh-CN/' },
{ text: '入门指南', link: '/zh-CN/getting-started' },
{ text: 'Core', link: '/zh-CN/core/' },
{ text: 'ECS', link: '/zh-CN/ecs/' },
{ text: 'Game', link: '/zh-CN/game/' },
{ text: 'Godot', link: '/zh-CN/godot/' },
{ text: '源码生成器', link: '/zh-CN/source-generators' },
{ text: '教程', link: '/zh-CN/tutorials/' },
{ text: '最佳实践', link: '/zh-CN/best-practices/' },
{
text: '更多',
items: [
{ text: 'ECS', link: '/zh-CN/ecs/' },
{ text: '源码生成器', link: '/zh-CN/source-generators' },
{ text: '最佳实践', link: '/zh-CN/best-practices/' },
{ text: 'API 参考', link: '/zh-CN/api-reference' },
{ text: '常见问题', link: '/zh-CN/faq' },
{ text: '故障排查', link: '/zh-CN/troubleshooting' },

View File

@ -132,3 +132,46 @@
--vp-custom-block-tip-code-bg: var(--vp-c-brand-soft);
}
/**
* Component: Navigation
* -------------------------------------------------------------------------- */
@media (min-width: 768px) and (max-width: 1279px) {
/* Keep the search entry visible on medium desktop widths where nav links are the tightest. */
.VPNavBarSearch {
flex: 0 0 auto;
padding-left: 16px;
}
.VPNavBarSearch .VPNavBarSearchButton {
min-width: 0;
padding: 8px 10px;
}
.VPNavBarSearch .keys {
display: none;
}
.VPNavBarMenu {
min-width: 0;
}
.VPNavBarMenu .VPNavBarMenuLink,
.VPNavBarMenu .VPFlyout .button {
padding-left: 10px;
padding-right: 10px;
font-size: 13px;
}
}
@media (min-width: 1280px) {
/* Reserve stable room for the search button before appearance and social actions appear. */
.VPNavBarSearch {
min-width: 176px;
}
.VPNavBarSearch .VPNavBarSearchButton {
justify-content: space-between;
min-width: 176px;
}
}