From 55a45c7673a5435ba826516f86c1fe41cce34be9 Mon Sep 17 00:00:00 2001 From: Philipp Oppermann Date: Tue, 26 Nov 2019 15:49:46 +0100 Subject: [PATCH] Start adding support for translations --- blog/config.toml | 4 ++++ blog/content/second-edition/posts/_index.zh.md | 7 +++++++ blog/templates/second-edition/page.html | 7 +++++++ 3 files changed, 18 insertions(+) create mode 100644 blog/content/second-edition/posts/_index.zh.md diff --git a/blog/config.toml b/blog/config.toml index e7f374f9..1f86d6e1 100644 --- a/blog/config.toml +++ b/blog/config.toml @@ -5,6 +5,10 @@ highlight_code = true highlight_theme = "visual-studio-dark" generate_rss = true +languages = [ + { code = "zh" }, # Chinese +] + [extra] subtitle = "Philipp Oppermann's blog" author = { name = "Philipp Oppermann" } diff --git a/blog/content/second-edition/posts/_index.zh.md b/blog/content/second-edition/posts/_index.zh.md new file mode 100644 index 00000000..d9da15d1 --- /dev/null +++ b/blog/content/second-edition/posts/_index.zh.md @@ -0,0 +1,7 @@ ++++ +title = "Posts" +sort_by = "weight" +insert_anchor_links = "left" +render = false +page_template = "second-edition/page.html" ++++ diff --git a/blog/templates/second-edition/page.html b/blog/templates/second-edition/page.html index 0a39a024..f9b4e685 100644 --- a/blog/templates/second-edition/page.html +++ b/blog/templates/second-edition/page.html @@ -35,6 +35,13 @@ {% endif %} + {% if page.lang != "en" %} +
+ Translated Content + This page was translated from english. TODO +
+ {% endif %} + {{ page.content | replace(from="", to=macros::toc(toc=page.toc)) | safe }}