Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 29 additions & 24 deletions docs/.vitepress/config.mts
Original file line number Diff line number Diff line change
@@ -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',
Expand Down Expand Up @@ -62,6 +83,10 @@ export default defineConfig({
chunkSizeWarningLimit: 1000
}
},
themeConfig: {
// 在顶层保留搜索配置,避免构建期只读取站点级配置时把搜索入口裁掉。
search: localSearch
},
/** 多语言 */
locales: {
root: {
Expand All @@ -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' },
Expand Down
43 changes: 43 additions & 0 deletions docs/.vitepress/theme/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Loading