This is a Jekyll 3.x static blog (GitHub Pages site) for the personal static blog 「代码的回声」.
- No Gemfile exists. Gems are installed globally via
sudo gem install. The required gems are:jekyll(~>3.9),jekyll-sitemap,jekyll-gist,jekyll-paginate,redcarpet,pygments.rb. _config.ymluses deprecated keys (gems:instead ofplugins:,pygments: trueinstead ofhighlighter: pygments). These produce deprecation warnings but still work in Jekyll 3.x. Do not "fix" these unless the project owner requests it.jekyll-gistis not listed in_config.ymlbut is required bypages/markdown.md. On GitHub Pages it is auto-loaded; locally you must use the local config override:jekyll serve --config _config.yml,_config_local.yml._config_local.ymloverridesbaseurl/urlfor localhost and adds the missingjekyll-gistandjekyll-paginateplugins. Always pass both configs for local dev.
jekyll serve --config _config.yml,_config_local.yml --host 0.0.0.0 --port 4000Site available at http://localhost:4000/.
jekyll build --config _config.yml,_config_local.ymlOutput goes to _site/.
There are no automated tests or linting configured in this repository. Travis CI (.travis.yml) only echoes commit info.
The site uses a lightweight client-side i18n system. No heavy plugins required.
- UI strings live in
_data/i18n.yml(keyedzh:/en:). - Elements use
data-i18n-zh/data-i18n-enattributes;js/i18n.jsswaps text on load based onlocalStorage('site-lang'). - A language switcher (ZH ↔ EN) sits in the nav bar (
_includes/lang-switcher.html).
- Existing ZH-only posts need no changes; they work as-is and fall back correctly when the UI language is EN.
- To add an English version of a post, create a sibling file with the same date and a
-ensuffix:- ZH:
_posts/YYYY-MM-DD-slug.md— add front matterlang: zhandtranslation_key: slug-YYYY-MM-DD - EN:
_posts/YYYY-MM-DD-slug-en.md— add front matterlang: en, sametranslation_key, and a uniquepermalink
- ZH:
- Example front matter for EN twin:
--- layout: post title: AI Twitter Highlights · 2026-09-17 lang: en translation_key: ai-twitter-hots-2026-09-17 permalink: /2026/09/17/ai-twitter-hots-en ---
- The
translation_keymust match exactly between ZH and EN files. When a user switches language on a post page, the JS navigates to the sibling if it exists; otherwise the ZH content stays visible with a notice.
Pages like about.md use data-bilingual-zh / data-bilingual-en attributes for inline content switching, and title_en front matter for the page heading.
atom.xml filters out lang: en posts to keep the feed ZH-primary. EN posts are accessible via direct URL and the language switcher.