blog

My blog at www.shimmy1996.com

git clone git://git.shimmy1996.com/blog.git
commit 25bbccb0f9e929fde551e4e5fbb3e851d4a2839c
parent f71aaa36504a93388843e71e835dab3d575caaf1
Author: Shimmy Xu <shimmy.america@gmail.com>
Date:   Mon, 28 Aug 2017 21:53:09 -0500

Better multilingual supports.

Diffstat:
Aarchetypes/default.en.md | 7+++++++
Mconfig.toml | 19++++++-------------
Mcontent/post/Hello-World.en.md | 1+
Mcontent/post/Hello-World.zh.md | 1+
Mcontent/post/The-Plan.en.md | 1+
Mcontent/post/The-Plan.zh.md | 1+
Ai18n/en.toml | 3+++
Ai18n/zh.toml | 3+++
Mlayouts/partials/foot_custom.html | 9+++++++--
Cthemes/soresu/layouts/404.html -> layouts/partials/head_custom.html | 0
Alayouts/partials/navi_custom.html | 8++++++++
Mthemes/soresu/LICENSE.md | 2+-
Mthemes/soresu/archetypes/default.md | 6++++--
Mthemes/soresu/layouts/404.html | 5+++++
Mthemes/soresu/layouts/_default/list.html | 18++++++++++++++++++
Mthemes/soresu/layouts/_default/single.html | 12++++++++++++
Dthemes/soresu/layouts/index.html | 0
Mthemes/soresu/layouts/partials/footer.html | 9+++++++++
Mthemes/soresu/layouts/partials/header.html | 21+++++++++++++++++++++
Mthemes/soresu/theme.toml | 27+++++++++------------------
20 files changed, 117 insertions(+), 36 deletions(-)
diff --git a/archetypes/default.en.md b/archetypes/default.en.md
@@ -0,0 +1,7 @@
+---
+title: ""
+slug: "{{ replace .TranslationBaseName "-" " " | title }}"
+date: {{ .Date }}
+draft: true
+---
+
diff --git a/config.toml b/config.toml
@@ -2,7 +2,7 @@ baseURL                 = "http://138.68.49.31/"
 copyright               = "Mine! Mine! Mine!"
 title                   = "Library of Trantor" 
 newContentEditor        = "emacs"
-theme                   = "hugo-xmin"
+theme                   = "soresu"
 pygmentsStyle           = "monokai"
 disqusshortname         = "shimmy1996"
 preserveTaxonomyNames = true
@@ -11,7 +11,7 @@ DefaultContentLanguage  = "en"
 DefaultContentLanguageInSubdir = true
 
 [permalinks]
-    post = "/post/:year/:month/:day/:slug/"
+post = "/post/:year/:month/:day/:slug/"
 
 [author]
 name                    = "Shimmy Xu"
@@ -22,10 +22,10 @@ twitter                 = "shimmy1996"
 [Languages.en]
 title                   = "Trantor Library"
 subtitle                = "The Plan is going on."
+LanguageName            = "EN"
 
 [Languages.en.params]
-    description = "The greatest library ever."
-    footer = "&copy; [Shimmy Xu](http://shimmy1996.com) 2017 | [Github](https://github.com/shimmy1996) | [Twitter](https://twitter.com/shimmy1996) | [Subscribe](/en/index.xml)"
+description = "The greatest library ever."
 
 [Languages.en.navigation]
 about                   = "About"
@@ -58,21 +58,17 @@ about                   = "About"
     name = "Messages"
     url = "/en/messages/"
     weight = 7
-[[Languages.en.menu.main]]
-    name = "中文"
-    url = "/zh/"
-
 
 [Languages.zh]
 title                   = "川坨图书室"
 subtitle                = "计划进行中。"
+LanguageName            = "中文"
 
 [Languages.zh.navigation]
 about                   = "关于"
 
 [Languages.zh.params]
-    description = "The greatest library ever."
-    footer = "&copy; [Shimmy Xu](http://shimmy1996.com) 2017 | [Github](https://github.com/shimmy1996) | [Twitter](https://twitter.com/shimmy1996) | [订阅](/zh/index.xml)"
+description = "最伟大的图书馆。"
 
 [[Languages.zh.menu.main]]
     name = "主页"
@@ -102,6 +98,3 @@ about                   = "关于"
     name = "留言板"
     url = "/zh/messages/"
     weight = 7
-[[Languages.zh.menu.main]]
-    name = "EN"
-    url = "/en/"
diff --git a/content/post/Hello-World.en.md b/content/post/Hello-World.en.md
@@ -1,5 +1,6 @@
 ---
 title: "Hello World"
+slug: "hello world"
 date: 2017-08-25T21:57:21-05:00
 draft: false
 ---
diff --git a/content/post/Hello-World.zh.md b/content/post/Hello-World.zh.md
@@ -1,5 +1,6 @@
 ---
 title: "你好世界"
+slug: "hello world"
 date: 2017-08-25T21:57:21-05:00
 draft: false
 ---
diff --git a/content/post/The-Plan.en.md b/content/post/The-Plan.en.md
@@ -1,5 +1,6 @@
 ---
 title: "The Plan"
+slug: "the plan"
 date: 2017-08-26T09:53:10-07:00
 draft: false
 ---
diff --git a/content/post/The-Plan.zh.md b/content/post/The-Plan.zh.md
@@ -1,5 +1,6 @@
 ---
 title: "计划"
+slug: "the plan"
 date: 2017-08-26T09:53:10-07:00
 draft: false
 ---
diff --git a/i18n/en.toml b/i18n/en.toml
@@ -0,0 +1,2 @@
+[footer]
+other = "&copy; [Shimmy Xu](http://shimmy1996.com) 2017 | [Github](https://github.com/shimmy1996) | [Twitter](https://twitter.com/shimmy1996) | [Subscribe](/en/index.xml)"+
\ No newline at end of file
diff --git a/i18n/zh.toml b/i18n/zh.toml
@@ -0,0 +1,2 @@
+[footer]
+other = "&copy; [Shimmy Xu](http://www.shimmy1996.com) 2017 | [Github](https://github.com/shimmy1996) | [Twitter](https://twitter.com/shimmy1996) | [订阅](/zh/index.xml)"+
\ No newline at end of file
diff --git a/layouts/partials/foot_custom.html b/layouts/partials/foot_custom.html
@@ -2,4 +2,9 @@
 <script src="/js/math-code.js"></script>
 <script async src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/MathJax.js?config=TeX-MML-AM_CHTML"></script>
 <!-- Disqus Support -->
-{{ template "_internal/disqus.html" . }}-
\ No newline at end of file
+{{ template "_internal/disqus.html" . }}
+<!-- Translated footer -->
+{{ with i18n "footer" }}
+    <hr/>
+    {{ . | markdownify }}
+{{ end }}+
\ No newline at end of file
diff --git a/themes/soresu/layouts/404.html b/layouts/partials/head_custom.html
diff --git a/layouts/partials/navi_custom.html b/layouts/partials/navi_custom.html
@@ -0,0 +1,7 @@
+{{ if .IsTranslated }}
+    {{ range .Translations }}
+    <li>
+        <a href="{{ .Permalink }}">{{ .Site.Language.LanguageName }}</a>
+    </li>
+    {{ end}}
+{{ end }}+
\ No newline at end of file
diff --git a/themes/soresu/LICENSE.md b/themes/soresu/LICENSE.md
@@ -1,6 +1,6 @@
 The MIT License (MIT)
 
-Copyright (c) 2017 YOUR_NAME_HERE
+Copyright (c) 2017 Yihui Xie
 
 Permission is hereby granted, free of charge, to any person obtaining a copy of
 this software and associated documentation files (the "Software"), to deal in
diff --git a/themes/soresu/archetypes/default.md b/themes/soresu/archetypes/default.md
@@ -1,2 +1,4 @@
-+++
-+++
+---
+title: ''
+date: ''
+---
diff --git a/themes/soresu/layouts/404.html b/themes/soresu/layouts/404.html
@@ -0,0 +1,5 @@
+{{ partial "header.html" . }}
+
+404 NOT FOUND
+
+{{ partial "footer.html" . }}
diff --git a/themes/soresu/layouts/_default/list.html b/themes/soresu/layouts/_default/list.html
@@ -0,0 +1,18 @@
+{{ partial "header.html" . }}
+
+{{if not .IsHome }}
+<h1>{{ .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>
+  </li>
+  {{ end }}
+</ul>
+
+{{ partial "footer.html" . }}
diff --git a/themes/soresu/layouts/_default/single.html b/themes/soresu/layouts/_default/single.html
@@ -0,0 +1,12 @@
+{{ 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 }}
+</div>
+
+<main>
+{{ .Content }}
+</main>
+
+{{ partial "footer.html" . }}
diff --git a/themes/soresu/layouts/index.html b/themes/soresu/layouts/index.html
diff --git a/themes/soresu/layouts/partials/footer.html b/themes/soresu/layouts/partials/footer.html
@@ -0,0 +1,9 @@
+  <footer>
+  {{ partial "foot_custom.html" . }}
+  {{ with .Site.Params.footer }}
+  <hr/>
+  {{ . | markdownify }}
+  {{ end }}
+  </footer>
+  </body>
+</html>
diff --git a/themes/soresu/layouts/partials/header.html b/themes/soresu/layouts/partials/header.html
@@ -0,0 +1,21 @@
+<!DOCTYPE html>
+<html lang="{{ .Site.LanguageCode }}">
+  <head>
+    <meta charset="utf-8">
+    <meta name="viewport" content="width=device-width, initial-scale=1">
+    <title>{{ .Title }} | {{ .Site.Title }}</title>
+    <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>
diff --git a/themes/soresu/theme.toml b/themes/soresu/theme.toml
@@ -1,21 +1,12 @@
-# theme.toml template for a Hugo theme
-# See https://github.com/gohugoio/hugoThemes#themetoml for an example
-
-name = "Soresu"
+name = "XMin"
 license = "MIT"
-licenselink = "https://github.com/yourname/yourtheme/blob/master/LICENSE.md"
-description = ""
-homepage = "http://example.com/"
-tags = []
-features = []
-min_version = "0.26"
+licenselink = "https://github.com/yihui/hugo-xmin/blob/master/LICENSE.md"
+description = "eXtremely Minimal Hugo theme: about 150 lines of code in total, including HTML and CSS"
+homepage = "https://xmin.yihui.name"
+tags = ["minimal", "blog", "personal", "clean", "simple", "starter", "minimalist"]
+features = ["blog"]
+min_version = "0.18"
 
 [author]
-  name = ""
-  homepage = ""
-
-# If porting an existing theme
-[original]
-  name = ""
-  homepage = ""
-  repo = ""
+  name = "Yihui Xie"
+  homepage = "https://yihui.name"