diff options
author | panr <radoslaw.koziel@gmail.com> | 2019-01-20 19:55:51 +0300 |
---|---|---|
committer | panr <radoslaw.koziel@gmail.com> | 2019-01-20 19:55:51 +0300 |
commit | e0787f1e1d3db00402964091b8a453b35baca746 (patch) | |
tree | e04eca2467f568decb09fad41f507f87e25f8e17 | |
parent | 62709b72195cdf5b89f8e4d82073e52c39827fa0 (diff) |
Add multilanguage support1.0.8
-rw-r--r-- | README.md | 10 | ||||
-rw-r--r-- | exampleSite/config.toml | 8 | ||||
-rw-r--r-- | layouts/_default/list.html | 4 | ||||
-rw-r--r-- | layouts/_default/single.html | 4 | ||||
-rw-r--r-- | theme.toml | 6 |
5 files changed, 22 insertions, 10 deletions
@@ -56,7 +56,7 @@ $ git submodule add https://github.com/panr/hugo-theme-hello-friend.git themes/h The theme doesn't require any advanced configuration. Just copy: ``` -baseurl = "https://example.org/" +baseurl = "/" languageCode = "en-us" title = "Hello Friend" theme = "hello-friend" @@ -84,9 +84,15 @@ paginate = 5 identifier = "showcase" name = "Showcase" url = "/showcase" + +[languages] + [languages.en] + writtenBy = "Written by" + readMore = "Read more" + readOtherPosts = "Read other posts" ``` -to `config.toml` file in your Hugo root directory and change params fields. +to `config.toml` file in your Hugo root directory and change params fields. In case you need, here's [a YAML version](https://gist.github.com/panr/8f9b363e358aaa33f6d353c77feee959). ## How to run your site diff --git a/exampleSite/config.toml b/exampleSite/config.toml index f138adb..c1ad606 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -1,4 +1,4 @@ -baseurl = "https://example.org/" +baseurl = "/" languageCode = "en-us" title = "Hello Friend" theme = "hugo-theme-hello-friend" @@ -26,3 +26,9 @@ paginate = 5 identifier = "showcase" name = "Showcase" url = "/showcase" + +[languages] + [languages.en] + writtenBy = "Written by" + readMore = "Read more" + readOtherPosts = "Read other posts" diff --git a/layouts/_default/list.html b/layouts/_default/list.html index b7029fd..4ceeb47 100644 --- a/layouts/_default/list.html +++ b/layouts/_default/list.html @@ -8,7 +8,7 @@ <span class="post-date"> {{ .Date.Format "2006-01-02" }} </span> - <span class="post-author">Written by {{ .Params.Author }}</span> + <span class="post-author">{{ .Site.Params.WrittenBy }} {{ .Params.Author }}</span> </div> {{ if .Params.tags }} @@ -32,7 +32,7 @@ {{ end }} {{ end }} </div> - <div><a class="read-more button" href="{{.RelPermalink}}">Read more →</a></div> + <div><a class="read-more button" href="{{.RelPermalink}}">{{ .Site.Params.ReadMore }} →</a></div> </div> {{ end }} {{ partial "pagination.html" . }} diff --git a/layouts/_default/single.html b/layouts/_default/single.html index 47579d9..f3bddd4 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -5,7 +5,7 @@ <span class="post-date"> {{ .Date.Format "2006-01-02" }} </span> - <span class="post-author">Written by {{ .Params.Author }}</span> + <span class="post-author">{{ .Site.Params.WrittenBy }} {{ .Params.Author }}</span> </div> {{ if .Params.tags }} @@ -26,7 +26,7 @@ {{ if or .NextInSection .PrevInSection }} <div class="pagination"> <div class="pagination__title"> - <span class="pagination__title-h">Read other posts</span> + <span class="pagination__title-h">{{ .Site.Params.ReadOtherPosts }}</span> <hr /> </div> <div class="pagination__buttons"> @@ -7,6 +7,6 @@ features = ["blog", "shortcode"] min_version = 0.30 [author] - name = "panr" - homepage = "https://radoslawkoziel.pl" - twitter = "https://twitter.com/panr" + name = "panr" + homepage = "https://radoslawkoziel.pl" + twitter = "https://twitter.com/panr" |