Skip to content

refactor(docs): consolidate site content into single data source#7

Merged
LessUp merged 1 commit into
masterfrom
copilot/arch-deepening-20260522
May 22, 2026
Merged

refactor(docs): consolidate site content into single data source#7
LessUp merged 1 commit into
masterfrom
copilot/arch-deepening-20260522

Conversation

@LessUp
Copy link
Copy Markdown
Owner

@LessUp LessUp commented May 22, 2026

Summary

  • 统一文档站点的数据层,将所有硬编码的导航、侧边栏、算法目录和基准测试元数据提取到 site-content.mjs 模块
  • 消除英文和中文语言环境之间的重复代码,确保单一数据源
  • 添加测试覆盖以确保跨语言环境的数据一致性

Changes

  • 创建 site-content.mjs 包含 algorithmCatalogbenchmarkCatalog、导航和侧边栏配置
  • buildNav/buildSidebar 函数替换内联配置
  • 简化 AlgorithmGridBenchmarkChart 组件以使用集中式数据
  • 添加 HomeLanding 组件使用新的数据层
  • 删除 LanguageDetector(功能已集成到 utils)
  • 为跨语言环境的数据一致性添加全面的测试
  • config.ts 从约 200 行减少到约 50 行

Benefits

  • 所有站点元数据的单一数据源
  • 带有测试覆盖的类型安全数据访问
  • 更易于维护和扩展
  • 跨语言环境的一致导航

Test plan

  • 所有单元测试通过(C++、Go、Rust)
  • 新增的文档数据层测试通过
  • 文档站点构建成功
  • 代码风格符合项目规范

Extract all hardcoded navigation, sidebar, algorithm catalog, and benchmark
metadata into a unified site-content.mjs module. This eliminates duplication
between English and Chinese locales and ensures a single source of truth.

Changes:
- Create site-content.mjs with algorithmCatalog, benchmarkCatalog, nav, sidebar
- Replace inline config with buildNav/buildSidebar functions
- Simplify AlgorithmGrid and BenchmarkChart to use centralized data
- Add HomeLanding component using new data layer
- Remove LanguageDetector (functionality integrated into utils)
- Add comprehensive tests for data consistency across locales
- Reduce config.ts from ~200 lines to ~50 lines

Benefits:
- Single source of truth for all site metadata
- Type-safe data access with test coverage
- Easier to maintain and extend
- Consistent navigation across locales
@LessUp LessUp merged commit 708b3a0 into master May 22, 2026
3 of 5 checks passed
@LessUp LessUp deleted the copilot/arch-deepening-20260522 branch May 22, 2026 07:14
LessUp added a commit that referenced this pull request May 22, 2026
refactor(docs): consolidate site content into single data source
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant