Skip to content

Comments

feat(seo): 完成高级 SEO 优化配置#16

Merged
piratf merged 28 commits intomainfrom
feat-seo-optimization
Jan 31, 2026
Merged

feat(seo): 完成高级 SEO 优化配置#16
piratf merged 28 commits intomainfrom
feat-seo-optimization

Conversation

@piratf
Copy link
Owner

@piratf piratf commented Jan 31, 2026

概述

完成 GitHub Pages 站点的 SEO 优化配置,解决根目录 404 问题并实现多语言 SEO 最佳实践。

主要变更

文档结构重组

  • 中文版作为根目录(解决根目录 404 问题)
  • 英文版移至 /en/ 子目录

SEO 优化

  • ✅ 添加 hreflang 标签(zh-CN, en-US, x-default)
  • ✅ 配置 sitemap.xml 生成(包含正确的 base path)
  • ✅ 添加 robots.txt 文件
  • ✅ 为中英文首页添加 JSON-LD 结构化数据(SoftwareSourceCode schema)

文档优化

  • 更新描述为更自然的表达方式

测试计划

  • 本地构建验证通过
  • 本地预览验证 SEO 元素正确
  • CI/CD 检查通过
  • 部署后验证页面可访问

piratf added 28 commits January 31, 2026 03:25
- 使用 gettext + babel 实现国际化
- 支持英文和中文
- 自动检测系统语言
- 支持命令行参数 --lang 手动指定语言
- 添加 README.md (英文) 和 README.zh-CN.md (中文)
- 配置 polint 检查翻译文件质量
- 添加 pre-commit hooks 自动提取和检查翻译
- 支持通过 python -m remark.cli 运行模块
- Track messages.pot file for translation completeness checking
- Use pybabel update --check instead of custom script
- Rename README.zh-CN.md to README.zh.md (W3C standard)
- Update language badges in README files
- Add i18n completeness check to pre-commit hooks
- 新增 _get_windows_locale() 函数,使用 ctypes 调用 Windows API
- 优先使用 GetUserDefaultLocaleName 获取用户默认区域设置
- 改进 get_system_language() 处理各种 locale 格式
- 添加 i18n 单元测试(31 个测试用例)
- 修复 --lang 参数帮助文本(zh_CN -> zh)
主要更改:
- remark.spec: 添加 locale_datas 收集 .mo 文件到打包
- remark/i18n.py: 修复 _get_locale_dir() 路径解析,打包后使用 sys._MEIPASS/locale
- remark/cli/commands.py: 在 main() 中强制设置控制台编码为 UTF-8
- Bump version from 2.0.5 to 2.0.6
- Add 'comment' keyword to pyproject.toml for SEO
- Update README with dual-language H1 title
- Add badges (Python version, License)
- Add Star Us section
- Enhance description with remark/comment keywords
- Update GitHub About description via gh CLI
- Add 12 topics: windows, folder, remark, comment, desktop, command-line, utility, python, portable, cli, automation, tool
- Add VitePress configuration with English and Chinese locales
- Create documentation structure: /en/ and /zh/
- Add getting started, usage, and API reference pages
- Add documentation links to README.md
- Update .gitignore to exclude node_modules
- Rename README.zh.md to README.en.md (English version)
- Update README.md to be the primary Chinese version with English summary
- Update language switch badges to point to README.md and README.en.md
- Add GitHub Actions workflow to deploy VitePress site to GitHub Pages
Modify get_system_language() to check LANG environment variable first
before Windows API. This allows tests to reliably control language
by setting LANG environment variable in conftest.py.

Also update test_windows_platform_priority to clear LANG env var
to properly test Windows API fallback behavior.
Add explicit set_language("zh") call in pytest_configure to ensure
all tests use Chinese translations. This fixes test failures where
tests expected Chinese output but got English.
Move sys import to the beginning of pytest_configure function
to avoid UnboundLocalError.
Add an autouse fixture that calls set_language("zh") before each test.
This ensures the translator is initialized to Chinese even if modules
were imported before pytest_configure ran.
Move set_language("zh") call to module level in conftest.py,
executing before any test modules are imported. This ensures
the translator is initialized to Chinese globally.

Also change autouse fixture scope to session for efficiency.
Add debug output in conftest.py to help diagnose why
translation files are not being loaded correctly in CI.
- Remove .mo files from .gitignore to allow them in repository
- Add locale/zh/LC_MESSAGES/messages.mo to enable translations in CI
- This fixes the issue where tests in CI were outputting English
  instead of Chinese due to missing translation files

The .mo file is compiled from .po source using pybabel compile.
Including compiled files in the repository ensures translations work
in all environments without requiring build tools.
- 移除 "约 12MB" 等具体版本号信息
- 移除 "隐私优先" 等不够具体的描述
- 统一修改为:
  - "无系统驻留,无数据上传,安全放心,用完即走" (中文)
  - "No system residency, no data upload, safe and secure, use it when you need it" (英文)

修改文件:
- README.md
- README.en.md
- docs/zh/index.md
- docs/en/index.md
- 重组文档结构:中文版作为根目录,英文版作为 /en/ 子目录
- 添加 hreflang 标签用于多语言 SEO
- 配置 sitemap.xml 生成,修复 base path 问题
- 添加 robots.txt 文件
- 为中英文首页添加 JSON-LD 结构化数据
- 更新文档描述为更自然的表达方式
@piratf piratf merged commit 115e9d6 into main Jan 31, 2026
4 checks passed
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