blog

My blog at www.shimmy1996.com

git clone git://git.shimmy1996.com/blog.git
commit 6c11fb0047df3211b35bbbf18a22df32a3262144
parent bad81b44f9006f4e55d95ac15f9562716dd9a6c3
Author: Shimmy Xu <shimmy.america@gmail.com>
Date:   Fri,  1 Sep 2017 00:02:05 -0500

Added i18n for lists and terms pages. Added .md template for posts archtype.

Diffstat:
Darchetypes/default.en.md | 7-------
Aarchetypes/default.zh.md~ | 13+++++++++++++
Aarchetypes/posts.md | 13+++++++++++++
Aarchetypes/posts.md~ | 13+++++++++++++
Mconfig.toml | 4++--
Mcontent/_index.en.md | 2+-
Mcontent/_index.zh.md | 2+-
Dcontent/post/Hello-World.en.md | 21---------------------
Dcontent/post/Hello-World.md~ | 9---------
Dcontent/post/Hello-World.zh.md | 19-------------------
Dcontent/post/Hello-World.zh.md~ | 20--------------------
Dcontent/post/The-Plan.en.md | 9---------
Dcontent/post/The-Plan.zh.md | 9---------
Dcontent/post/The-Plan~ | 6------
Acontent/posts/2017-08-31-hello-world.en.md | 15+++++++++++++++
Acontent/posts/2017-08-31-hello-world.en.md~ | 15+++++++++++++++
Acontent/posts/2017-08-31-hello-world.zh.md | 15+++++++++++++++
Acontent/posts/2017-08-31-hello-world.zh.md~ | 15+++++++++++++++
Mi18n/en.toml | 12++++++++++--
Mi18n/zh.toml | 12++++++++++--
Alayouts/_default/list.html | 20++++++++++++++++++++
Alayouts/_default/single.html | 13+++++++++++++
Alayouts/_default/terms.html | 16++++++++++++++++
23 files changed, 172 insertions(+), 108 deletions(-)
diff --git a/archetypes/default.en.md b/archetypes/default.en.md
@@ -1,7 +0,0 @@
----
-title: ""
-slug: "{{ replace .TranslationBaseName "-" " " | title }}"
-date: {{ .Date }}
-draft: true
----
-
diff --git a/archetypes/default.zh.md~ b/archetypes/default.zh.md~
@@ -0,0 +1,13 @@
++++
+title           = ""
+description     = ""
+date            = {{ .Date }}
+draft           = true
+tags            = [
+                  ]
+categories      = [
+                  ]
+slug            =  "{{ replace .TranslationBaseName "-" " " | title }}"
+isCJKLanguage   = false
++++
+
diff --git a/archetypes/posts.md b/archetypes/posts.md
@@ -0,0 +1,13 @@
++++
+title           = ""
+description     = ""
+date            = {{ .Date }}
+draft           = true
+tags            = [
+                  ]
+categories      = [
+                  ]
+slug            =  "{{ replace .TranslationBaseName "-" " " | title }}"
+isCJKLanguage   = false
++++
+
diff --git a/archetypes/posts.md~ b/archetypes/posts.md~
@@ -0,0 +1,13 @@
++++
+title           = ""
+description     = ""
+date            = {{ .Date }}
+draft           = true
+tags            = [
+                  ]
+categories      = [
+                  ]
+slug            =  "{{ replace .TranslationBaseName "-" " " | title }}"
+isCJKLanguage   = false
++++
+
diff --git a/config.toml b/config.toml
@@ -36,7 +36,7 @@ about                   = "About"
     weight = 1
 [[Languages.en.menu.main]]
     name = "Posts"
-    url = "/en/post/"
+    url = "/en/posts/"
     weight = 2
 [[Languages.en.menu.main]]
     name = "Tags"
@@ -76,7 +76,7 @@ description = "最伟大的图书馆。"
     weight = 1
 [[Languages.zh.menu.main]]
     name = "归档"
-    url = "/zh/post/"
+    url = "/zh/posts/"
     weight = 2
 [[Languages.zh.menu.main]]
     name = "标签"
diff --git a/content/_index.en.md b/content/_index.en.md
@@ -15,7 +15,6 @@ _The Plan needs to go on._
 - [x] ~~Search for WP replacement.~~ Hugo is pretty good.
 - [x] ~~Find a suitable theme.~~ Currently using `hugo-xmin`, may consider forking it and write my own ( `soresu` ).
 - [x] Server side config, like `post-receive` for git auto deploy.
-- [x] Configure multilingual support, including footer text, title, etc.
 - [x] Language switcher that does more than redirecting to home page.
 - [x] Enable Disqus.
 - [x] Support `$\LaTeX$` expressions via MathJax.
@@ -23,6 +22,7 @@ _The Plan needs to go on._
 - [x] Enable https.
 - [x] Backup old WP site.
 - [x] Transfer domain and ensure NDS works as intended.
+- [ ] Configure multilingual support, including footer text, title, etc.
 - [ ] Use Google Noto Font.
 - [ ] Customizable Disqus via Disqus API.
 - [ ] Find out how to write with `org-mode` or R markdown.
diff --git a/content/_index.zh.md b/content/_index.zh.md
@@ -15,7 +15,6 @@ _计划进行中_
 - [x] ~~搜寻WP的替代品。~~ Hugo很不错。
 - [x] ~~找一个合适的主题。~~ 目前使用 `hugo-xmin`,考虑fork出来写成自己的主题( `soresu` )。
 - [x] 完成服务器端设置,比如添加 `post-receive` 来实现 `git` 自动部署。
-- [x] 设置多语言支持,添加合适的翻译字符串。
 - [x] 可以切换__当前页面__语言版本的语言切换按钮。
 - [x] Disqus支持。
 - [x] 用MathJax实现 `$\LaTeX$` 表达式支持。
@@ -23,6 +22,7 @@ _计划进行中_
 - [x] https支持。
 - [x] 备份原WP站点。
 - [x] 转移域名到Google Domain,并完成NDS设置。
+- [ ] 设置多语言支持,添加合适的翻译字符串。
 - [ ] 使用Google Noto Font。
 - [ ] 用Disqus API实现可以自定义的评论框。
 - [ ] 尝试使用 `org-mode` 或者 R markdown 来写博客。
diff --git a/content/post/Hello-World.en.md b/content/post/Hello-World.en.md
@@ -1,20 +0,0 @@
----
-title: "Hello World"
-slug: "hello world"
-date: 2017-08-25T21:57:21-05:00
-draft: false
----
-
-Hellow World!
-The plan must go on. 
-
-This is my first post on the site.  I hope that you like it!
-
-## Welcome Function
-
-Here is a little Python function to welcome you:
-
-{{< highlight python >}}
-def hello_world():
-    print "Hello there!"
-{{< /highlight >}}-
\ No newline at end of file
diff --git a/content/post/Hello-World.md~ b/content/post/Hello-World.md~
@@ -1,9 +0,0 @@
----
-title: "Hello World"
-date: 2017-08-25T21:57:21-05:00
-draft: false
----
-
-Hellow World!
-The plan must go on. 
-
diff --git a/content/post/Hello-World.zh.md b/content/post/Hello-World.zh.md
@@ -1,18 +0,0 @@
----
-title: "你好世界"
-slug: "hello world"
-date: 2017-08-25T21:57:21-05:00
-draft: false
----
-
-Nihao!
-The plan must go on. 
-
-## Welcome Function
-
-Here is a little Python function to welcome you:
-
-{{< highlight python >}}
-def hello_world():
-    print "Nihao!"
-{{< /highlight >}}-
\ No newline at end of file
diff --git a/content/post/Hello-World.zh.md~ b/content/post/Hello-World.zh.md~
@@ -1,19 +0,0 @@
----
-title: "Hello World"
-date: 2017-08-25T21:57:21-05:00
-draft: false
----
-
-Hellow World!
-The plan must go on. 
-
-This is my first post on the site.  I hope that you like it!
-
-## Welcome Function
-
-Here is a little Python function to welcome you:
-
-{{< highlight python >}}
-def hello_world():
-    print "Hello there!"
-{{< /highlight >}}-
\ No newline at end of file
diff --git a/content/post/The-Plan.en.md b/content/post/The-Plan.en.md
@@ -1,9 +0,0 @@
----
-title: "The Plan"
-slug: "the plan"
-date: 2017-08-26T09:53:10-07:00
-draft: false
----
-
-I am the most powerful human being in the world.
-
diff --git a/content/post/The-Plan.zh.md b/content/post/The-Plan.zh.md
@@ -1,9 +0,0 @@
----
-title: "计划"
-slug: "the plan"
-date: 2017-08-26T09:53:10-07:00
-draft: false
----
-
-这也是计划的一部分。
-
diff --git a/content/post/The-Plan~ b/content/post/The-Plan~
@@ -1,6 +0,0 @@
----
-title: "The Plan"
-date: 2017-08-26T09:53:10-07:00
-draft: true
----
-
diff --git a/content/posts/2017-08-31-hello-world.en.md b/content/posts/2017-08-31-hello-world.en.md
@@ -0,0 +1,15 @@
++++
+title           = "Hello World!"
+description     = "Cuz's it's always the right name for a first post!"
+date            = 2017-08-31T23:09:59-05:00
+draft           = false
+tags            = ["Hugo"
+                  ]
+categories      = ["Site Related"
+                  ]
+slug            =  "hello world"
+isCJKLanguage   = false
++++
+
+Hello world!
+
diff --git a/content/posts/2017-08-31-hello-world.en.md~ b/content/posts/2017-08-31-hello-world.en.md~
@@ -0,0 +1,15 @@
++++
+title           = "Hello World!"
+description     = "Same old first post."
+date            = 2017-08-31T23:09:59-05:00
+draft           = false
+tags            = ["Hugo"
+                  ]
+categories      = ["Site Related"
+                  ]
+slug            =  "hello world"
+isCJKLanguage   = false
++++
+
+Hello world!
+
diff --git a/content/posts/2017-08-31-hello-world.zh.md b/content/posts/2017-08-31-hello-world.zh.md
@@ -0,0 +1,15 @@
++++
+title           = "你好世界!"
+description     = "第一篇文章!"
+date            = 2017-08-31T23:09:59-05:00
+draft           = false
+tags            = ["Hugo"
+                  ]
+categories      = ["Site Related"
+                  ]
+slug            =  "hello world"
+isCJKLanguage   = true
++++
+
+你好世界!
+
diff --git a/content/posts/2017-08-31-hello-world.zh.md~ b/content/posts/2017-08-31-hello-world.zh.md~
@@ -0,0 +1,15 @@
++++
+title           = "Hello World!"
+description     = "Same old first post."
+date            = 2017-08-31T23:09:59-05:00
+draft           = false
+tags            = ["Hugo"
+                  ]
+categories      = ["Site Related"
+                  ]
+slug            =  "hello world"
+isCJKLanguage   = false
++++
+
+Hello world!
+
diff --git a/i18n/en.toml b/i18n/en.toml
@@ -1,2 +1,11 @@
 [footer]
-other = "&copy; [Shimmy Xu](http://www.shimmy1996.com/en/) 2017 | [Github](https://github.com/shimmy1996) | [Twitter](https://twitter.com/shimmy1996) | [Subscribe](/en/index.xml)"-
\ No newline at end of file
+other = "&copy; [Shimmy Xu](http://www.shimmy1996.com/en/) 2017 | [Github](https://github.com/shimmy1996) | [Twitter](https://twitter.com/shimmy1996) | [Subscribe](/en/index.xml)"
+
+[Posts]
+other = "Posts"
+
+[Tags]
+other = "Tags"
+
+[Categories]
+other = "Categories"
diff --git a/i18n/zh.toml b/i18n/zh.toml
@@ -1,2 +1,11 @@
 [footer]
-other = "&copy; [Shimmy Xu](http://www.shimmy1996.com/zh/) 2017 | [Github](https://github.com/shimmy1996) | [Twitter](https://twitter.com/shimmy1996) | [订阅](/zh/index.xml)"-
\ No newline at end of file
+other = "&copy; [Shimmy Xu](http://www.shimmy1996.com/zh/) 2017 | [Github](https://github.com/shimmy1996) | [Twitter](https://twitter.com/shimmy1996) | [订阅](/zh/index.xml)"
+
+[Posts]
+other = "归档"
+
+[Tags]
+other = "标签"
+
+[Categories]
+other = "分类"
diff --git a/layouts/_default/list.html b/layouts/_default/list.html
@@ -0,0 +1,20 @@
+{{ partial "header.html" . }}
+
+{{if not .IsHome }}
+<h1>{{ i18n .Title }}</h1>
+{{ end }}
+
+{{ .Content }}
+
+<ul>
+  {{ range (where .Data.Pages "Section" "!=" "") }}
+  <li>
+    <span class="date">{{ .Date.Format "2006/01/02" }}</span>
+    <a href="{{ .URL }}">{{ .Title }}</a>
+    <br>
+    {{.Description}}
+  </li>
+  {{ end }}
+</ul>
+
+{{ partial "footer.html" . }}
diff --git a/layouts/_default/single.html b/layouts/_default/single.html
@@ -0,0 +1,13 @@
+{{ partial "header.html" . }}
+<div class="article-meta">
+<h1><span class="title">{{ .Title }}</span></h1>
+{{ with .Params.author }}<h2 class="author">{{ . }}</h2>{{ end }}
+{{ if .Params.date }}<h2 class="date">{{ .Date.Format "2006/01/02" }}</h2>{{ end }}
+<!-- {{ with .Params.description }}<h4 class="description">{{ . }}</h4>{{ end }} -->
+</div>
+
+<main>
+{{ .Content }}
+</main>
+
+{{ partial "footer.html" . }}
diff --git a/layouts/_default/terms.html b/layouts/_default/terms.html
@@ -0,0 +1,16 @@
+{{ partial "header.html" . }}
+
+<h1>{{ i18n .Title }}</h1>
+
+<ul class="terms">
+  {{ range $key, $value := .Data.Terms }}
+  <li>
+    <a href="{{ (print "/" $.Data.Plural "/" $key | urlize) | relURL }}">
+      {{ $key }}
+    </a>
+    ({{ len $value }})
+  </li>
+  {{ end }}
+</ul>
+
+{{ partial "footer.html" . }}