commit 971bb816650b98cdd60adb995a4dd5f6e04bb63a
parent 1fffaa4087d2a35cf71b7d2cb5e07762f8910494
Author: Shimmy Xu <shimmy.america@gmail.com>
Date: Sun, 10 Sep 2017 12:29:27 -0500
Better implementation for translating tags/categories/titles.
Diffstat:
10 files changed, 61 insertions(+), 46 deletions(-)
diff --git a/content/posts/2017-08-31-hello-world.en.org b/content/posts/2017-08-31-hello-world.en.org
@@ -8,7 +8,6 @@ tags = ["Hugo"
categories = ["Site Related"
]
slug = "hello world"
-isCJKLanguage = false
+++
Hello world!
diff --git a/content/posts/2017-08-31-hello-world.zh.org b/content/posts/2017-08-31-hello-world.zh.org
@@ -8,7 +8,6 @@ tags = ["Hugo"
categories = ["Site Related"
]
slug = "hello world"
-isCJKLanguage = true
+++
你好世界!
diff --git a/content/posts/2017-09-03-get-emacs-to-work-with-fcitx.en.org b/content/posts/2017-09-03-get-emacs-to-work-with-fcitx.en.org
@@ -8,7 +8,6 @@ tags = [
categories = [
]
slug = "get-emacs-to-work-with-fcitx"
-isCJKLanguage = false
+++
* Enabling fcitx in emacs
diff --git a/content/posts/2017-09-03-get-emacs-to-work-with-fcitx.zh.org b/content/posts/2017-09-03-get-emacs-to-work-with-fcitx.zh.org
@@ -8,7 +8,6 @@ tags = [
categories = [
]
slug = "get-emacs-to-work-with-fcitx"
-isCJKLanguage = true
+++
* Enabling fcitx in emacs
diff --git a/i18n/en.toml b/i18n/en.toml
@@ -4,21 +4,12 @@ other = "© 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,21 +4,12 @@ other = "© 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,33 +1,38 @@
{{ partial "header.html" . }}
{{if not .IsHome }}
-<h1>{{i18n .Title }}</h1>
+ {{$title := i18n .Title}}
+ {{ if eq $title ""}}
+ <h1>{{ .Title }}</h1>
+ {{ else }}
+ <h1>{{ $title }}</h1>
+ {{ end }}
{{ end }}
{{ .Content }}
{{if not .IsHome }}
-<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>
+ <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>
{{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>
+ <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,11 @@
{{ partial "header.html" . }}
-<h1>{{i18n .Title }}</h1>
+{{$title := i18n .Title}}
+{{ if eq $title ""}}
+ <h1>{{ .Title }}</h1>
+{{ else }}
+ <h1>{{ $title }}</h1>
+{{ end }}
{{ .Content }}
diff --git a/layouts/partials/head_custom.html b/layouts/partials/head_custom.html
@@ -6,4 +6,11 @@
<link rel="mask-icon" href="/favicon/safari-pinned-tab.svg?v=xQzOP7B4B2" color="#710100">
<link rel="shortcut icon" href="/favicon/favicon.ico?v=xQzOP7B4B2">
<meta name="msapplication-config" content="/favicon/browserconfig.xml?v=xQzOP7B4B2">
-<meta name="theme-color" content="#ffffff">-
\ No newline at end of file
+<meta name="theme-color" content="#ffffff">
+<!-- Translate titles -->
+{{$title := i18n .Title}}
+{{ if eq $title ""}}
+ <title>{{ .Title }} | {{ .Site.Title }}</title>
+{{ else }}
+ <title>{{ $title }} | {{ .Site.Title }}</title>
+{{ end }}+
\ No newline at end of file
diff --git a/layouts/partials/header.html b/layouts/partials/header.html
@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+<html lang="{{ .Site.LanguageCode }}">
+ <head>
+ <meta charset="utf-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1">
+ <link rel="stylesheet" href="{{ "/css/style.css" | relURL }}" />
+ <link rel="stylesheet" href="{{ "/css/fonts.css" | relURL }}" />
+ {{ partial "head_custom.html" . }}
+ </head>
+
+ <body>
+ <nav>
+ <ul class="menu">
+ {{ range .Site.Menus.main }}
+ <li><a href="{{ .URL | relURL }}">{{ .Name }}</a></li>
+ {{ end }}
+ {{ partial "navi_custom.html" . }}
+ </ul>
+ <hr/>
+ </nav>