Skip to content

Commit 0f9d2fb

Browse files
committed
索引文件多语言支持
1 parent cea1052 commit 0f9d2fb

File tree

3 files changed

+42
-1
lines changed

3 files changed

+42
-1
lines changed

index.en.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
layout: null
3+
collections:
4+
- name: launcher
5+
title: Launcher
6+
- name: modpack
7+
title: Modpack
8+
---
9+
[
10+
{%- for collection in page.collections -%}
11+
{"title":"{{ collection.title }}","items":[
12+
{%- assign documents = site[collection.name] | where: "locale", page.locale -%}
13+
{%- for document in documents -%}
14+
{"title":"{{ document.title }}","subtitle":"{{ document.excerpt }}","url":"{{ document.url | absolute_url }}"}
15+
{%- unless forloop.last %},{% endunless -%}
16+
{%- endfor -%}
17+
]}
18+
{%- unless forloop.last %},{% endunless -%}
19+
{%- endfor -%}
20+
]

index.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ collections:
99
[
1010
{%- for collection in page.collections -%}
1111
{"title":"{{ collection.title }}","items":[
12-
{%- for document in site[collection.name] -%}
12+
{%- assign documents = site[collection.name] | where: "locale", page.locale -%}
13+
{%- for document in documents -%}
1314
{"title":"{{ document.title }}","subtitle":"{{ document.excerpt }}","url":"{{ document.url | absolute_url }}"}
1415
{%- unless forloop.last %},{% endunless -%}
1516
{%- endfor -%}

index.zh-Hant.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
layout: null
3+
collections:
4+
- name: launcher
5+
title: 啟動器
6+
- name: modpack
7+
title: 整合包
8+
---
9+
[
10+
{%- for collection in page.collections -%}
11+
{"title":"{{ collection.title }}","items":[
12+
{%- assign documents = site[collection.name] | where: "locale", page.locale -%}
13+
{%- for document in documents -%}
14+
{"title":"{{ document.title }}","subtitle":"{{ document.excerpt }}","url":"{{ document.url | absolute_url }}"}
15+
{%- unless forloop.last %},{% endunless -%}
16+
{%- endfor -%}
17+
]}
18+
{%- unless forloop.last %},{% endunless -%}
19+
{%- endfor -%}
20+
]

0 commit comments

Comments
 (0)