diff options
author | olOwOlo <26087907+olOwOlo@users.noreply.github.com> | 2018-01-30 21:26:46 +0800 |
---|---|---|
committer | olOwOlo <26087907+olOwOlo@users.noreply.github.com> | 2018-01-30 21:26:46 +0800 |
commit | 084f8cb2c350f44fd99bf0fc76beadbfc92e9f02 (patch) | |
tree | 31d9df6a69f2bcf5678c7882239a20d0862cea70 | |
parent | dcff1e389f0474bf01bdacbad6313fbdadab5329 (diff) |
feat: support multilingual mode
* fix: wrong lang attribute in multilingual mode
- baseof.html
* fix: rss link in multilingual mode
- footer.html
* fix: wrong tags, categories, home link in multilingual mode
- other files ...
This relates to #25
-rw-r--r-- | layouts/404.html | 2 | ||||
-rw-r--r-- | layouts/_default/baseof.html | 2 | ||||
-rw-r--r-- | layouts/_default/terms.html | 4 | ||||
-rw-r--r-- | layouts/partials/footer.html | 6 | ||||
-rw-r--r-- | layouts/partials/header.html | 2 | ||||
-rw-r--r-- | layouts/partials/slideout.html | 2 | ||||
-rw-r--r-- | layouts/post/single.html | 4 | ||||
-rw-r--r-- | layouts/post/summary.html | 2 |
8 files changed, 14 insertions, 10 deletions
diff --git a/layouts/404.html b/layouts/404.html index 50e1860..fcf2b37 100644 --- a/layouts/404.html +++ b/layouts/404.html @@ -4,7 +4,7 @@ <div class="not-found"> <h1 class="error-emoji"></h1> <p class="error-text">/* 404 page not found. */</p> - <p class="error-link"><a href="{{ "/" | relURL }}">↑ Back Home ↑</a></p> + <p class="error-link"><a href="{{ "/" | relLangURL }}">↑ Back Home ↑</a></p> </div> <script> var errorEmojiContainer = document.getElementsByClassName('error-emoji')[0]; diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index 60edd94..445c5fb 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -1,5 +1,5 @@ <!DOCTYPE html> -<html lang="{{ $.Site.LanguageCode | default "en" }}"> +<html lang="{{ .Site.Language }}"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> diff --git a/layouts/_default/terms.html b/layouts/_default/terms.html index fbf0045..7bdafb9 100644 --- a/layouts/_default/terms.html +++ b/layouts/_default/terms.html @@ -16,7 +16,7 @@ </div> <div class="categories-tags"> {{ range $key, $value := $terms }} - <a class="category-link" href="{{ $name | urlize | relURL }}/{{ $value.Term | urlize }}/"> + <a class="category-link" href="{{ $name | relLangURL }}/{{ $value.Term | urlize }}/"> {{ $value.Term }} <span class="category-count">{{ len $value.Pages }}</span> </a> @@ -34,7 +34,7 @@ </div> <div class="tag-cloud-tags"> {{ range $key, $value := $terms }} - <a href="{{ $name | urlize | relURL }}/{{ $value.Term | urlize }}/"> + <a href="{{ $name | relLangURL }}/{{ $value.Term | urlize }}/"> {{ $value.Term }} <span class="tag-count">{{ len $value.Pages }}</span> </a> diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html index e03ed24..287c65c 100644 --- a/layouts/partials/footer.html +++ b/layouts/partials/footer.html @@ -6,7 +6,11 @@ <a href="{{ $path | safeURL }}" class="iconfont icon-{{ $realName }}" title="{{ $realName }}"></a> {{- end }} {{- end }} - <a href="{{ .Site.RSSLink }}" type="application/rss+xml" class="iconfont icon-rss" title="rss"></a> + {{ if .Site.LanguagePrefix -}} + <a href="{{ .Site.LanguagePrefix | absURL }}/index.xml" type="application/rss+xml" class="iconfont icon-rss" title="rss"></a> + {{- else -}} + <a href="{{ .Site.RSSLink }}" type="application/rss+xml" class="iconfont icon-rss" title="rss"></a> + {{- end }} </div> <div class="copyright"> diff --git a/layouts/partials/header.html b/layouts/partials/header.html index 57cf431..3592e88 100644 --- a/layouts/partials/header.html +++ b/layouts/partials/header.html @@ -1,5 +1,5 @@ <div class="logo-wrapper"> - <a href="{{ "/" | relURL }}" class="logo"> + <a href="{{ "/" | relLangURL }}" class="logo"> {{- if .Site.Params.logoTitle -}} {{ .Site.Params.logoTitle }} {{- else -}} diff --git a/layouts/partials/slideout.html b/layouts/partials/slideout.html index e8cebd3..42ed13e 100644 --- a/layouts/partials/slideout.html +++ b/layouts/partials/slideout.html @@ -1,6 +1,6 @@ <div id="mobile-navbar" class="mobile-navbar"> <div class="mobile-header-logo"> - <a href="{{ "/" | relURL }}" class="logo"> + <a href="{{ "/" | relLangURL }}" class="logo"> {{- if .Site.Params.logoTitle -}} {{ .Site.Params.logoTitle }} {{- else -}} diff --git a/layouts/post/single.html b/layouts/post/single.html index 6f8e545..58434b6 100644 --- a/layouts/post/single.html +++ b/layouts/post/single.html @@ -10,7 +10,7 @@ {{ with .Params.categories -}} <div class="post-category"> {{ range . }} - <a href="{{ "categories" | relURL }}/{{ . | urlize }}/"> {{ . }} </a> + <a href="{{ "categories" | relLangURL }}/{{ . | urlize }}/"> {{ . }} </a> {{ end }} </div> {{- end }} @@ -43,7 +43,7 @@ {{ with .Params.tags -}} <div class="post-tags"> {{ range . }} - <a href="{{ "tags" | relURL }}/{{ . | urlize }}/">{{ . }}</a> + <a href="{{ "tags" | relLangURL }}/{{ . | urlize }}/">{{ . }}</a> {{ end }} </div> {{- end }} diff --git a/layouts/post/summary.html b/layouts/post/summary.html index bbebe31..0695eac 100644 --- a/layouts/post/summary.html +++ b/layouts/post/summary.html @@ -7,7 +7,7 @@ {{ with .Params.categories -}} <div class="post-category"> {{ range . }} - <a href="{{ "categories" | relURL }}/{{ . | urlize }}/"> {{ . }} </a> + <a href="{{ "categories" | relLangURL }}/{{ . | urlize }}/"> {{ . }} </a> {{ end }} </div> {{- end }} |