Add multilanguage support
This commit is contained in:
parent
62709b7219
commit
e0787f1e1d
5 changed files with 22 additions and 10 deletions
10
README.md
10
README.md
|
@ -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:
|
The theme doesn't require any advanced configuration. Just copy:
|
||||||
|
|
||||||
```
|
```
|
||||||
baseurl = "https://example.org/"
|
baseurl = "/"
|
||||||
languageCode = "en-us"
|
languageCode = "en-us"
|
||||||
title = "Hello Friend"
|
title = "Hello Friend"
|
||||||
theme = "hello-friend"
|
theme = "hello-friend"
|
||||||
|
@ -84,9 +84,15 @@ paginate = 5
|
||||||
identifier = "showcase"
|
identifier = "showcase"
|
||||||
name = "Showcase"
|
name = "Showcase"
|
||||||
url = "/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
|
## How to run your site
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
baseurl = "https://example.org/"
|
baseurl = "/"
|
||||||
languageCode = "en-us"
|
languageCode = "en-us"
|
||||||
title = "Hello Friend"
|
title = "Hello Friend"
|
||||||
theme = "hugo-theme-hello-friend"
|
theme = "hugo-theme-hello-friend"
|
||||||
|
@ -26,3 +26,9 @@ paginate = 5
|
||||||
identifier = "showcase"
|
identifier = "showcase"
|
||||||
name = "Showcase"
|
name = "Showcase"
|
||||||
url = "/showcase"
|
url = "/showcase"
|
||||||
|
|
||||||
|
[languages]
|
||||||
|
[languages.en]
|
||||||
|
writtenBy = "Written by"
|
||||||
|
readMore = "Read more"
|
||||||
|
readOtherPosts = "Read other posts"
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
<span class="post-date">
|
<span class="post-date">
|
||||||
{{ .Date.Format "2006-01-02" }}
|
{{ .Date.Format "2006-01-02" }}
|
||||||
</span>
|
</span>
|
||||||
<span class="post-author">Written by {{ .Params.Author }}</span>
|
<span class="post-author">{{ .Site.Params.WrittenBy }} {{ .Params.Author }}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{ if .Params.tags }}
|
{{ if .Params.tags }}
|
||||||
|
@ -32,7 +32,7 @@
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
</div>
|
</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>
|
</div>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ partial "pagination.html" . }}
|
{{ partial "pagination.html" . }}
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
<span class="post-date">
|
<span class="post-date">
|
||||||
{{ .Date.Format "2006-01-02" }}
|
{{ .Date.Format "2006-01-02" }}
|
||||||
</span>
|
</span>
|
||||||
<span class="post-author">Written by {{ .Params.Author }}</span>
|
<span class="post-author">{{ .Site.Params.WrittenBy }} {{ .Params.Author }}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{ if .Params.tags }}
|
{{ if .Params.tags }}
|
||||||
|
@ -26,7 +26,7 @@
|
||||||
{{ if or .NextInSection .PrevInSection }}
|
{{ if or .NextInSection .PrevInSection }}
|
||||||
<div class="pagination">
|
<div class="pagination">
|
||||||
<div class="pagination__title">
|
<div class="pagination__title">
|
||||||
<span class="pagination__title-h">Read other posts</span>
|
<span class="pagination__title-h">{{ .Site.Params.ReadOtherPosts }}</span>
|
||||||
<hr />
|
<hr />
|
||||||
</div>
|
</div>
|
||||||
<div class="pagination__buttons">
|
<div class="pagination__buttons">
|
||||||
|
|
Loading…
Reference in a new issue