about summary refs log tree commit diff
path: root/layouts/partials
diff options
context:
space:
mode:
authorNgô Ngọc Đức Huy <huyngo@disroot.org>2023-07-29 17:33:12 +0700
committerNgô Ngọc Đức Huy <huyngo@disroot.org>2023-07-29 17:33:12 +0700
commit8261eed6f8c2aeb2488a481f1d89ab9c8ff3a119 (patch)
tree4dd87c1ca0f2ebc2a459395ee10a3547db3be106 /layouts/partials
parent5f84f18c24b3bf64768befad82823a59c26e65d5 (diff)
downloadvictor-8261eed6f8c2aeb2488a481f1d89ab9c8ff3a119.tar.gz
Support multilingual
Diffstat (limited to 'layouts/partials')
-rw-r--r--layouts/partials/footer.html5
-rw-r--r--layouts/partials/head.html5
-rw-r--r--layouts/partials/header.html5
-rw-r--r--layouts/partials/language-switcher.html11
-rw-r--r--layouts/partials/post-language-switcher.html6
5 files changed, 24 insertions, 8 deletions
diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html
index 619beab..341bed7 100644
--- a/layouts/partials/footer.html
+++ b/layouts/partials/footer.html
@@ -5,10 +5,9 @@ SPDX-License-Identifier: MIT
 */}}
 
 <footer class="common-footer" id="footer">
-  {{ $languagesCount := $.Site.Home.AllTranslations }}
-  {{/* if gt $languagesCount 1 }}
+  {{ if .Site.IsMultiLingual }}
     {{ partial "language-switcher.html" . }}
-  {{ end */}}
+  {{ end }}
 
   <div class="common-footer-bottom">
     <div class="copyright">
diff --git a/layouts/partials/head.html b/layouts/partials/head.html
index 79d51b5..3857a99 100644
--- a/layouts/partials/head.html
+++ b/layouts/partials/head.html
@@ -1,4 +1,7 @@
-{{ $style := resources.Get "css/readable/readable.css" }}
+{{ $readable := resources.Get "css/readable/readable.css" }}
+{{ $theme := resources.Get "css/theme.css" }}
+{{ $custom := resources.Get "css/custom.css" }}
+{{ $style := slice $readable $theme $custom | resources.Concat "css/style.css" | minify | fingerprint }}
 
 <meta charset="utf-8">
 <meta name="HandheldFriendly" content="True">
diff --git a/layouts/partials/header.html b/layouts/partials/header.html
index d015389..7b35a2a 100644
--- a/layouts/partials/header.html
+++ b/layouts/partials/header.html
@@ -1,3 +1,6 @@
 <nav>
-	<a href="/" >{{ .Site.Title }}</a>
+	<a href="{{ .Site.Home.RelPermalink | absLangURL }}" >{{ .Site.Title }}</a>
+	{{ range .Site.Menus.main }}
+	<a href="{{ .URL | absLangURL }}">{{ .Title }}</a>
+	{{ end }}
 </nav>
diff --git a/layouts/partials/language-switcher.html b/layouts/partials/language-switcher.html
new file mode 100644
index 0000000..af29a78
--- /dev/null
+++ b/layouts/partials/language-switcher.html
@@ -0,0 +1,11 @@
+{{ i18n "choose language" }}
+{{ $pageLang := .Page.Lang}}
+<nav>
+	{{ range .AllTranslations }}
+		{{ if eq .Lang $pageLang }}
+			<a>{{ .Language.LanguageName }} ({{ i18n "current" }})</a>
+		{{ else }}
+			<a href="{{ .Permalink }}">{{ .Language.LanguageName }}</a>
+		{{ end }}
+	{{ end }}
+</nav>
diff --git a/layouts/partials/post-language-switcher.html b/layouts/partials/post-language-switcher.html
index 162cdf3..d5faf75 100644
--- a/layouts/partials/post-language-switcher.html
+++ b/layouts/partials/post-language-switcher.html
@@ -4,13 +4,13 @@
         {{ range .AllTranslations }}
             {{ if eq .Lang $pageLang }}
                 <li>
-                    {{ upper .Lang }}
+                    {{ .Language.LanguageName }} ({{ i18n "current" }})
                 </li>
             {{ else }}
                 <li>
-                    <a href="{{ .Permalink }}">{{ upper .Lang }}</a>
+                    <a href="{{ .Permalink }}">{{ .Language.LanguageName }}</a>
                 </li>
             {{ end }}
         {{ end }}
     </ul>
-{{ end }}
\ No newline at end of file
+{{ end }}