blog

My blog at www.shimmy1996.com

git clone git://git.shimmy1996.com/blog.git
commit 1fffaa4087d2a35cf71b7d2cb5e07762f8910494
parent 5f0d9ad4c6b56a35ed5491f55a728b0733232626
Author: Shimmy Xu <shimmy.america@gmail.com>
Date:   Sun, 10 Sep 2017 11:55:43 -0500

Adjustments on Tags and Categories pages.

Diffstat:
Mconfig.toml | 28++++++----------------------
Acontent/categories/_index.en.org | 3+++
Acontent/categories/_index.zh.org | 3+++
Acontent/posts/_index.en.org | 5+++++
Acontent/posts/_index.zh.org | 5+++++
Acontent/tags/_index.en.org | 3+++
Acontent/tags/_index.zh.org | 3+++
Mi18n/en.toml | 9+++++++++
Mi18n/zh.toml | 9+++++++++
Mlayouts/_default/list.html | 15++++++++++++++-
Mlayouts/_default/terms.html | 4+++-
11 files changed, 63 insertions(+), 24 deletions(-)
diff --git a/config.toml b/config.toml
@@ -42,25 +42,17 @@ about                   = "About"
     url = "/en/posts/"
     weight = 2
 [[Languages.en.menu.main]]
-    name = "Tags"
-    url = "/en/tags/"
-    weight = 3
-[[Languages.en.menu.main]]
-    name = "Categories"
-    url = "/en/categories/"
-    weight = 4
-[[Languages.en.menu.main]]
     name = "About"
     url = "/en/about/"
-    weight = 5
+    weight = 3
 [[Languages.en.menu.main]]
     name = "Friends"
     url = "/en/friends/"
-    weight = 6
+    weight = 4
 [[Languages.en.menu.main]]
     name = "Messages"
     url = "/en/messages/"
-    weight = 7
+    weight = 5
 
 [Languages.zh]
 title                   = "川坨大学图书室"
@@ -82,22 +74,14 @@ description = "最伟大的图书馆。"
     url = "/zh/posts/"
     weight = 2
 [[Languages.zh.menu.main]]
-    name = "标签"
-    url = "/zh/tags/"
-    weight = 3
-[[Languages.zh.menu.main]]
-    name = "分类"
-    url = "/zh/categories/"
-    weight = 4
-[[Languages.zh.menu.main]]
     name = "关于"
     url = "/zh/about/"
-    weight = 5
+    weight = 3
 [[Languages.zh.menu.main]]
     name = "朋友们"
     url = "/zh/friends/"
-    weight = 6
+    weight = 4
 [[Languages.zh.menu.main]]
     name = "留言板"
     url = "/zh/messages/"
-    weight = 7
+    weight = 5
diff --git a/content/categories/_index.en.org b/content/categories/_index.en.org
@@ -0,0 +1,3 @@
+---
+title: "Categories"
+---
diff --git a/content/categories/_index.zh.org b/content/categories/_index.zh.org
@@ -0,0 +1,3 @@
+---
+title: "分类"
+---
diff --git a/content/posts/_index.en.org b/content/posts/_index.en.org
@@ -0,0 +1,5 @@
+---
+title: "Posts"
+---
+
+In case you want to view by [[/en/tags/][tags]] or [[/en/categories][categories]].
diff --git a/content/posts/_index.zh.org b/content/posts/_index.zh.org
@@ -0,0 +1,5 @@
+---
+title: "归档"
+---
+
+你也可以通过[[/zh/tags/][标签]]或[[/zh/categories][分类]]来浏览日志。
diff --git a/content/tags/_index.en.org b/content/tags/_index.en.org
@@ -0,0 +1,3 @@
+---
+title: "Tags"
+---
diff --git a/content/tags/_index.zh.org b/content/tags/_index.zh.org
@@ -0,0 +1,3 @@
+---
+title: "标签"
+---
diff --git a/i18n/en.toml b/i18n/en.toml
@@ -4,12 +4,21 @@ other = "&copy; Shimmy Xu 2017 | [Keybase](https://keybase.io/shimmy1996) | [Git
 [Posts]
 other = "Posts"
 
+[归档]
+other = "Posts"
+
 [Tags]
 other = "Tags"
 
+[标签]
+other = "Tags"
+
 [Categories]
 other = "Categories"
 
+[分类]
+other = "Categories"
+
 # Translation for tags
 [Hugo]
 other = "Hugo"
diff --git a/i18n/zh.toml b/i18n/zh.toml
@@ -4,12 +4,21 @@ other = "&copy; Shimmy Xu 2017 | [Keybase](https://keybase.io/shimmy1996) | [Git
 [Posts]
 other = "归档"
 
+[归档]
+other = "归档"
+
 [Tags]
 other = "标签"
 
+[标签]
+other = "标签"
+
 [Categories]
 other = "分类"
 
+[分类]
+other = "分类"
+
 # Translation for tags
 [Hugo]
 other = "Hugo"
diff --git a/layouts/_default/list.html b/layouts/_default/list.html
@@ -1,11 +1,12 @@
 {{ partial "header.html" . }}
 
 {{if not .IsHome }}
-<h1>{{ i18n .Title }}</h1>
+<h1>{{i18n .Title }}</h1>
 {{ end }}
 
 {{ .Content }}
 
+{{if not .IsHome }}
 <ul>
   {{ range (where .Data.Pages "Section" "!=" "") }}
   <li>
@@ -16,5 +17,17 @@
   </li>
   {{ end }}
 </ul>
+{{else}}
+<ul>
+  {{ range first 5 (where .Data.Pages "Section" "!=" "") }}
+  <li>
+    <span class="date">{{ .Date.Format "2006/01/02" }}</span>
+    <a href="{{ .URL }}">{{ .Title }}</a>
+    <br>
+    {{.Description}}
+  </li>
+  {{ end }}
+</ul>
+{{ end }}
 
 {{ partial "footer.html" . }}
diff --git a/layouts/_default/terms.html b/layouts/_default/terms.html
@@ -1,6 +1,8 @@
 {{ partial "header.html" . }}
 
-<h1>{{ i18n .Title }}</h1>
+<h1>{{i18n .Title }}</h1>
+
+{{ .Content }}
 
 <ul class="terms">
   {{ range $key, $value := .Data.Terms }}