docs: revamp homepage and switch to custom GitHub buttons

- Make the docs English-only by removing all zh-cn content, the language switcher UI, and related JS/config

- Rework homepage feature cards (Safe & Typed, Pure JavaScript, Shopify & Jekyll, Streaming) and refresh section colors/layout

- Replace buttons.github.io with custom Star/Sponsor buttons featuring a live star count and dark-mode support

- Drop the buttons.js script and tidy banner, header, footer, and share partials

Co-authored-by: Cursor <[email protected]>
This commit is contained in:
Yang Jun
2026-06-06 23:39:06 +08:00
co-authored by Cursor
parent 09bfe13f65
commit be18f33e20
138 changed files with 166 additions and 5969 deletions
+22 -19
View File
@@ -36,25 +36,6 @@
}
}());
(function() {
// lang select
function changeLang() {
var lang = this.value;
var canonical = this.dataset.canonical;
var path = '/';
if (lang !== 'en') path += lang + '/';
var expires = new Date();
expires.setFullYear(expires.getFullYear() + 1);
document.cookie = 'nf_lang=' + lang + ';path=/;expires=' + expires.toGMTString();
location.href = path + canonical;
}
document.getElementById('lang-select').addEventListener('change', changeLang);
document.getElementById('mobile-lang-select').addEventListener('change', changeLang);
}());
(function() {
// playground
/* global liquidjs, ace */
@@ -144,6 +125,28 @@
}
}());
(function() {
// GitHub star count
var el = document.getElementById('gh-star-count');
if (!el) return;
el.textContent = '1.8K';
if (!window.fetch) return;
fetch('https://api.github.com/repos/harttle/liquidjs')
.then(function(res) { return res.json(); })
.then(function(data) {
if (typeof data.stargazers_count === 'number') {
el.textContent = format(data.stargazers_count);
}
});
function format(n) {
if (n < 1000) return String(n);
var k = n / 1000;
return (k >= 10 ? Math.round(k) : Math.round(k * 10) / 10) + 'k';
}
}());
if ('serviceWorker' in navigator) {
window.addEventListener('load', function() {
navigator.serviceWorker.register('/sw.js').then(function(reg) {