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
This commit is contained in:
olOwOlo 2018-01-30 21:26:46 +08:00
parent dcff1e389f
commit 084f8cb2c3
No known key found for this signature in database
GPG key ID: 456394B6E7A15EA6
8 changed files with 14 additions and 10 deletions

View file

@ -4,7 +4,7 @@
<div class="not-found"> <div class="not-found">
<h1 class="error-emoji"></h1> <h1 class="error-emoji"></h1>
<p class="error-text">/* 404 page not found. */</p> <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> </div>
<script> <script>
var errorEmojiContainer = document.getElementsByClassName('error-emoji')[0]; var errorEmojiContainer = document.getElementsByClassName('error-emoji')[0];

View file

@ -1,5 +1,5 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="{{ $.Site.LanguageCode | default "en" }}"> <html lang="{{ .Site.Language }}">
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">

View file

@ -16,7 +16,7 @@
</div> </div>
<div class="categories-tags"> <div class="categories-tags">
{{ range $key, $value := $terms }} {{ 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 }} {{ $value.Term }}
<span class="category-count">{{ len $value.Pages }}</span> <span class="category-count">{{ len $value.Pages }}</span>
</a> </a>
@ -34,7 +34,7 @@
</div> </div>
<div class="tag-cloud-tags"> <div class="tag-cloud-tags">
{{ range $key, $value := $terms }} {{ range $key, $value := $terms }}
<a href="{{ $name | urlize | relURL }}/{{ $value.Term | urlize }}/"> <a href="{{ $name | relLangURL }}/{{ $value.Term | urlize }}/">
{{ $value.Term }} {{ $value.Term }}
<span class="tag-count">{{ len $value.Pages }}</span> <span class="tag-count">{{ len $value.Pages }}</span>
</a> </a>

View file

@ -6,7 +6,11 @@
<a href="{{ $path | safeURL }}" class="iconfont icon-{{ $realName }}" title="{{ $realName }}"></a> <a href="{{ $path | safeURL }}" class="iconfont icon-{{ $realName }}" title="{{ $realName }}"></a>
{{- end }} {{- end }}
{{- 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>
<div class="copyright"> <div class="copyright">

View file

@ -1,5 +1,5 @@
<div class="logo-wrapper"> <div class="logo-wrapper">
<a href="{{ "/" | relURL }}" class="logo"> <a href="{{ "/" | relLangURL }}" class="logo">
{{- if .Site.Params.logoTitle -}} {{- if .Site.Params.logoTitle -}}
{{ .Site.Params.logoTitle }} {{ .Site.Params.logoTitle }}
{{- else -}} {{- else -}}

View file

@ -1,6 +1,6 @@
<div id="mobile-navbar" class="mobile-navbar"> <div id="mobile-navbar" class="mobile-navbar">
<div class="mobile-header-logo"> <div class="mobile-header-logo">
<a href="{{ "/" | relURL }}" class="logo"> <a href="{{ "/" | relLangURL }}" class="logo">
{{- if .Site.Params.logoTitle -}} {{- if .Site.Params.logoTitle -}}
{{ .Site.Params.logoTitle }} {{ .Site.Params.logoTitle }}
{{- else -}} {{- else -}}

View file

@ -10,7 +10,7 @@
{{ with .Params.categories -}} {{ with .Params.categories -}}
<div class="post-category"> <div class="post-category">
{{ range . }} {{ range . }}
<a href="{{ "categories" | relURL }}/{{ . | urlize }}/"> {{ . }} </a> <a href="{{ "categories" | relLangURL }}/{{ . | urlize }}/"> {{ . }} </a>
{{ end }} {{ end }}
</div> </div>
{{- end }} {{- end }}
@ -43,7 +43,7 @@
{{ with .Params.tags -}} {{ with .Params.tags -}}
<div class="post-tags"> <div class="post-tags">
{{ range . }} {{ range . }}
<a href="{{ "tags" | relURL }}/{{ . | urlize }}/">{{ . }}</a> <a href="{{ "tags" | relLangURL }}/{{ . | urlize }}/">{{ . }}</a>
{{ end }} {{ end }}
</div> </div>
{{- end }} {{- end }}

View file

@ -7,7 +7,7 @@
{{ with .Params.categories -}} {{ with .Params.categories -}}
<div class="post-category"> <div class="post-category">
{{ range . }} {{ range . }}
<a href="{{ "categories" | relURL }}/{{ . | urlize }}/"> {{ . }} </a> <a href="{{ "categories" | relLangURL }}/{{ . | urlize }}/"> {{ . }} </a>
{{ end }} {{ end }}
</div> </div>
{{- end }} {{- end }}