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
+1 -1
View File
@@ -10,7 +10,7 @@ index:
get_started: Get Started
contributors:
title: Contributors
description: 'LiquidJS follows the <a href="https://github.com/all-contributors/all-contributors">all-contributors</a> specification, see <a href="tutorials/contribution-guidelines.html">guidelines here</a>! Thanks goes to these wonderful people:'
description: 'Thanks to these wonderful people! See <a href="tutorials/contribution-guidelines.html">contribution guidelines</a> if you&#39;d like to help.'
sponsors:
title: Sponsors
description: 'If you personally love LiquidJS or it&#39;s benefiting your business, please <a href="https://github.com/sponsors/harttle">sponsor us</a>!'
-68
View File
@@ -1,68 +0,0 @@
menu:
tutorials: 教程
tags: 标签
filters: 过滤器
playground: 演示
api: API
search: 搜索
index:
get_started: 开始使用
contributors:
title: 贡献
description: 'LiquidJS 欢迎任何形式的贡献,可以从 <a href="tutorials/contribution-guidelines.html">阅读贡献指南</a> 开始!感谢这些参与过 LiquidJS 项目的人:'
sponsors:
title: 赞助
description: '如果你喜欢 LiquidJS 或你的公司在使用 LiquidJS,请考虑 <a href="tutorials/contribution-guidelines.html#成为赞助者!">赞助 LiquidJS</a>'
playground:
title: 演示
loading: 加载中...
page:
contents: 目录
back_to_top: 回到顶部
improve: 改进这篇文档
report: 报告问题
prev: 上一页
next: 下一页
last_updated: 上次更新:%s
sidebar:
tutorials:
getting_started: 开始使用
intro: Liquid 简介
setup: 安装
options: 选项
render_file: 文件渲染
partials: 引用/继承
express: Express.js 中使用
advanced: 高级主题
caching: 缓存
escaping: 转义
registration: 注册标签/过滤器
access_scope_in_filters: 过滤器里访问上下文
parse_parameters: 参数解析
render_tag_content: 渲染标签内容
drops: Liquid Drop
sync_and_async: 同步和异步
whitespace: 换行和缩进
plugins: 插件
operators: 运算符
truth: 真和假
security_model: 安全模型
static_analysis: 静态分析
miscellaneous: 其他
migration9: '迁移到 LiquidJS 9'
contribution_guidelines: '贡献指南'
differences: 与 Shopify/liquid 的不同
changelog: '更新日志'
filters:
overview: 概述
tags:
overview: 概述
footer:
license: '本文档通过 <a href="http://creativecommons.org/licenses/by/4.0/" target="_blank">CC BY 4.0</a> 授权。'
+17 -32
View File
@@ -1,34 +1,28 @@
<header id="banner" class="wrapper">
<div class="inner inner-content">
<h2 id="banner-title">{{ page.subtitle }}</h2>
<div id="banner-share">{{ partial('partial/share') }}</div>
<div id="banner-start">
<code id="banner-start-command">npm install liquidjs</code><a id="banner-start-link" href="./tutorials/setup.html"><i class="icon-arrow-right"></i></a>
<a id="banner-github-link" href="https://github.com/{{ config.github }}" target="_blank" rel="noreferrer">GitHub</a>
</div>
<div id="banner-share">{{ partial('partial/share') }}</div>
</div>
</header>
<div id="intro-news-list">
<div class="wrapper">
<div class="inner inner-content">
<div id="intro-news-flex">
{% for news in site.data.news %}
<a href="{{news.url}}" class="intro-news-wrap">
<div class="intro-news-time">{{news.date}}</div>
<div class="intro-news-title">{{news.title[page.lang]}}</div>
</a>
{% endfor %}
</div>
</div>
</div>
</div>
<div id="content-wrap">
<div class="wrapper">
<div class="inner inner-content">
{{ page.content }}
<div id="intro-cmd-wrap" class="highlight typescript"><pre><span class="line"><span class="keyword">import</span> { Liquid } <span class="keyword">from</span> <span class="string">'liquidjs'</span></span><br><span class="line"><span class="keyword">const</span> engine = <span class="keyword">new</span> Liquid()</span><br><span class="line"><span class="keyword">const</span> tpl = engine.parse(<span class="string">'Welcome to {% raw %}{{v}}{% endraw %}!'</span>)</span><br><span class="line">engine.render(tpl, {<span class="attr">v</span>: <span class="string">"Liquid"</span>}).then(<span class="built_in">console</span>.log)</span><br><span class="line"><span class="comment">// Outputs "Welcome to Liquid!"</span></span><br></pre></div>
<div id="intro-get-started-wrap">
<a href="tutorials/setup.html" id="intro-get-started-link">{{ __('index.get_started') }}</a>
</div>
</div>
</div>
<div id="contributors-wrap">
<div class="wrapper">
<div class="inner inner-content">
<div class="section-header">
<h3>{{__('index.contributors.title')}}</h3>
<p class="description">{{__('index.contributors.description')}}</p>
</div>
<div class="contributors">
{{ partial('partial/all-contributors') }}
</div>
</div>
</div>
@@ -36,22 +30,13 @@
<div id="sponsors-wrap">
<div class="wrapper">
<div class="inner inner-content">
<h3>{{__('index.sponsors.title')}}</h3>
<p class="description">{{__('index.sponsors.description')}}</p>
<div class="section-header">
<h3>{{__('index.sponsors.title')}}</h3>
<p class="description">{{__('index.sponsors.description')}}</p>
</div>
<div class="contributors">
{{ partial('partial/financial-contributors') }}
</div>
</div>
</div>
</div>
<div id="contributors-wrap">
<div class="wrapper">
<div class="inner inner-content">
<h3>{{__('index.contributors.title')}}</h3>
<p class="description">{{__('index.contributors.description')}}</p>
<div class="contributors">
{{ partial('partial/all-contributors') }}
</div>
</div>
</div>
</div>
-1
View File
@@ -5,7 +5,6 @@
{{ js('js/main') }}
<script async defer src="https://buttons.github.io/buttons.js"></script>
<script src="https://cdn.jsdelivr.net/npm/docsearch.js@2/dist/cdn/docsearch.min.js"></script>
<script>
document.getElementById('search-input-wrap').classList.add('on');
+12 -11
View File
@@ -10,17 +10,18 @@
<input type="search" id="search-input" placeholder="{{__('menu.search')}}...">
</div>
</nav>
<div class="main-nav-link icon-nav-link">
<label><i class="icon-network"></i> <span class="icon-nav-title">{{ lang_name(page.lang) }}</span></label>
<select id="lang-select" data-canonical="{{ canonical_path_for_nav() }}">
{% for lang in site.data.languages %}
<option value="{{ loop.key }}"{% if page.lang === loop.key %} selected{% endif %}>{{ lang_name(loop.key) }}</option>
{% endfor %}
</select>
</div>
<div class="main-nav-link icon-nav-link github-buttons-wrap">
<a class="github-button" href="https://github.com/harttle/liquidjs" data-color-scheme="no-preference: light; light: light; dark: dark;" data-size="large" data-show-count="true" aria-label="Star harttle/liquidjs on GitHub">Star</a>
<a class="github-button" href="https://github.com/sponsors/harttle" data-color-scheme="no-preference: light; light: light; dark: dark;" data-size="large" aria-label="Sponsor @harttle on GitHub">Sponsor</a>
<div class="main-nav-link icon-nav-link github-buttons-wrap">
<span class="gh-star">
<a class="gh-btn" href="https://github.com/harttle/liquidjs" target="_blank" rel="noopener" aria-label="Star harttle/liquidjs on GitHub">
<svg class="gh-btn-icon" viewBox="0 0 16 16" width="16" height="16" aria-hidden="true"><path d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0 0 16 8c0-4.42-3.58-8-8-8z"></path></svg>
<span>Star</span>
</a>
<a class="gh-count" id="gh-star-count" href="https://github.com/harttle/liquidjs" target="_blank" rel="noopener" aria-label="harttle/liquidjs stargazers"></a>
</span>
<a class="gh-btn gh-sponsor" href="https://github.com/sponsors/harttle" target="_blank" rel="noopener" aria-label="Sponsor @harttle on GitHub">
<svg class="gh-btn-icon" viewBox="0 0 16 16" width="16" height="16" aria-hidden="true"><path d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0 0 16 8c0-4.42-3.58-8-8-8z"></path></svg>
<span>Sponsor</span>
</a>
</div>
<a id="mobile-nav-toggle">
<span class="mobile-nav-toggle-bar"></span>
-8
View File
@@ -12,13 +12,5 @@
<div id="mobile-button-list">
<a href="https://github.com/{{ config.github }}" class="mobile-nav-link" rel="external" target="_blank"><i class="icon-github"></i></a>
<a href="https://opencollective.com/liquidjs" class="mobile-nav-link" rel="external" target="_blank"><i class="icon-opencollective"></i></a>
<div id="mobile-lang-select-wrap" class="mobile-nav-link">
<label for="mobile-lang-select"><i class="icon-network"></i></label>
<select id="mobile-lang-select" data-canonical="{{ canonical_path_for_nav() }}">
{% for lang in site.data.languages %}
<option value="{{ loop.key }}"{% if page.lang === loop.key %} selected{% endif %}>{{ lang_name(loop.key) }}</option>
{% endfor %}
</select>
</div>
</div>
</nav>
-2
View File
@@ -1,5 +1,3 @@
<!-- GitHub star -->
<a href="https://github.com/harttle/liquidjs" target="_blank"><img src="https://img.shields.io/github/stars/harttle/liquidjs?style=flat-square" alt="Star"></a>
<!-- NPM Download -->
<a href="https://www.npmjs.com/package/liquidjs" target="_blank"><img src ="https://img.shields.io/npm/dm/liquidjs?logo=npm&style=flat-square" alt="NPM Downloads"></a>
<!-- Contributors button -->
+67 -9
View File
@@ -80,12 +80,70 @@ logo-size = 36px
@media mq-normal
display: block
#lang-select
opacity: 0
position: absolute
top: 0
left: 0
width: 100%
height: 100%
-webkit-appearance: menulist-button
font-size: inherit
@media mq-normal
.github-buttons-wrap
display: flex
align-items: center
line-height: normal
opacity: 1
span
display: inline-flex
align-items: center
.gh-star
display: inline-flex
margin-right: 12px
.gh-btn
border-radius: 0.25em 0 0 0.25em
.gh-btn, .gh-count
font: 600 12px/16px -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif
box-sizing: content-box
display: inline-flex
align-items: center
height: 16px
padding: 5px 10px
border: 1px solid #d1d9e0
color: #25292e
white-space: nowrap
.gh-btn
border-radius: 0.25em
background-color: #ebf0f4
background-image: linear-gradient(180deg, #f6f8fa, #ebf0f4 90%)
span
margin-left: 4px
&:hover, &:focus
color: #25292e
text-decoration: none
background-color: #e5eaee
background-image: linear-gradient(180deg, #eff2f5, #e5eaee 90%)
.gh-btn-icon
fill: currentColor
.gh-count
border-left: 0
border-radius: 0 0.25em 0.25em 0
background-color: #fff
&:hover, &:focus
color: #0969da
text-decoration: none
&:empty
display: none
@media (prefers-color-scheme: dark)
.gh-btn, .gh-count
border-color: #3d444d
color: #f0f6fc
.gh-btn
background-color: #1a2026
background-image: linear-gradient(180deg, #212830, #1a2026 90%)
&:hover, &:focus
color: #f0f6fc
background-color: #1f242c
background-image: linear-gradient(180deg, #262c36, #1f242c 90%)
.gh-count
background-color: #0d1117
&:hover, &:focus
color: #388bfd
+35 -81
View File
@@ -23,10 +23,12 @@
#banner-start
text-align: center
padding: 40px 0
padding: 40px 0 48px
line-height: 47px;
@media mq-tablet
padding-bottom: 64px
@media mq-normal
padding: 60px 0
padding-top: 60px
font-size: 18px
#banner-start-command
@@ -51,52 +53,15 @@
#banner-share
display: block
padding-bottom: 60px
#intro-news-list
background-color: var(--color-news-bg)
margin: -1px 0
#intro-news-flex
display: flex
flex-flow: column
@media mq-normal
flex-flow: row wrap
.intro-news-wrap
padding: 24px 30px
text-decoration: none
&:first-child
padding-left: 0
&:last-child
padding-right: 0
&:hover
background-color: var(--color-link-hover)
@media mq-normal
flex: 0 0 50%
padding: 36px 30px
@media screen and (min-width: 960px)
flex: 0 0 25%
.intro-news-time
font-size: 14px
color: rgba(255,255,255,.6)
.intro-news-wrap:hover .intro-news-time
color: rgba(255,255,255,.8)
.intro-news-title
padding-top: 4px
font-size: 15px
line-height: 1.2;
color: #fff
padding-top: 24px
#intro-feature-list
display: flex
flex-flow: column
margin: 30px 0
margin: 30px 0 50px
@media mq-normal
flex-flow: row wrap
margin: 30px 0 80px
.intro-feature-wrap
margin-top: 20px
@@ -112,7 +77,7 @@
padding-left: 48px
.intro-feature-icon
color: var(--color-link)
color: var(--color-default)
font-size: 36px
margin-bottom: 6px;
text-align: center
@@ -125,36 +90,22 @@
width: @font-size
.intro-feature-title
color: var(--color-link)
color: var(--color-default)
font-size: 24px
.intro-feature-desc
color: var(--color-gray)
margin-top: 1em
@media mq-normal
margin-top: line-height
line-height: line-height
a
text-decoration: none
color: black
&:visited, &:hover
color: black
color: var(--color-link)
&:hover
text-decoration: underline
@media (prefers-color-scheme: dark)
color: white
&:visited, &:hover
color: white
#intro-cmd-wrap
max-width: 700px
padding: 15px 30px
font-size: 16px
pre
line-height: 32px
overflow: auto
margin: 50px auto 0;
@media mq-normal
margin: 70px auto 0;
color: var(--color-link-hover)
code
color: var(--color-gray)
#intro-get-started-wrap
text-align: center
@@ -186,18 +137,36 @@
@media mq-tablet
margin-top: 64px
margin-bottom: 64px
.section-header
display: flex
align-items: baseline
justify-content: space-between
gap: 16px
margin: 0 0 24px
flex-wrap: wrap
h3
margin: 0
flex-shrink: 0
p.description
margin: 0
text-align: right
flex: 1
min-width: 0
color: var(--color-gray)
h3
color: #fff
font-size: 32px
p
color: #ccc
margin: 36px 0 24px
font-size: 20px
line-height: 1.5
.description a
text-decoration: none
color: var(--color-link)
&:hover
color: var(--color-link-hover)
#contributors-wrap
#sponsors-wrap
background: var(--color-content-bg)
.inner
h3
@@ -206,28 +175,13 @@
color: var(--color-gray)
.open-collective
max-width: 100%
.description a
color: #333
&:hover
background: var(--color-navy)
color: #fff
@media (prefers-color-scheme: dark)
p
color: var(--color-default)
.description a
color: #fff
&:hover
background: #fff
color: var(--color-navy-lighter)
#sponsors-wrap
#contributors-wrap
border: none
overflow: hidden;
.description a
color: #fff
&:hover
background: #fff
color: var(--color-navy-lighter)
.contributors
tr
+1 -4
View File
@@ -245,7 +245,4 @@ $article-footer-link
right: 0
.article-footer-updated
font-size: 0.9em
[lang="zh-cn"] .since::before
content: ""
font-size: 0.9em
-2
View File
@@ -10,7 +10,6 @@ vendor-prefixes = webkit moz ms official
--color-border: #e3e3e3
--color-navy: hsl(210, 25%, 12%)
--color-content-bg: #fff
--color-news-bg: darken(hsl(210, 25%, 12%), 5%)
--color-navy-lighter: lighten(hsl(210, 25%, 12%), 10%)
--color-link: #0e83cd
--color-link-hover: lighten(#0e83cd, 10%)
@@ -24,7 +23,6 @@ vendor-prefixes = webkit moz ms official
--color-border: #6a6a6a
--color-background: #fff
--color-navy: hsl(210, 25%, 12%)
--color-news-bg: darken(hsl(210, 25%, 12%), 5%)
--color-navy-lighter: lighten(hsl(210, 25%, 12%), 7%)
--color-content-bg: #1c1c1c
--color-link: #0e83cd
+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) {