about summary refs log tree commit diff
path: root/layouts/_default
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/_default
parent5f84f18c24b3bf64768befad82823a59c26e65d5 (diff)
downloadvictor-8261eed6f8c2aeb2488a481f1d89ab9c8ff3a119.tar.gz
Support multilingual
Diffstat (limited to 'layouts/_default')
-rw-r--r--layouts/_default/baseof.html4
-rw-r--r--layouts/_default/list.html40
-rw-r--r--layouts/_default/single.html4
3 files changed, 33 insertions, 15 deletions
diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html
index b17f8ce..bd9f83d 100644
--- a/layouts/_default/baseof.html
+++ b/layouts/_default/baseof.html
@@ -5,7 +5,11 @@ SPDX-License-Identifier: MIT
 */}}
 
 <!DOCTYPE html>
+{{ with .Page.Params.Lang }}
+<html lang="{{ . }}">
+{{ else }}
 <html lang="{{ .Page.Language.Lang }}">
+{{ end }}
 <head>
     {{ block "head" . }}
         {{ partial "head.html" . }}
diff --git a/layouts/_default/list.html b/layouts/_default/list.html
index ecac06c..7c774d5 100644
--- a/layouts/_default/list.html
+++ b/layouts/_default/list.html
@@ -11,26 +11,40 @@ SPDX-License-Identifier: MIT
   {{ if in .Params.categories "book" }}
   <section class="toc">
     <ol>
+      {{ range .Page.Translations | append .Page }}
       {{ range sort .Pages "Weight" }}
-        <li>
-          <a href="{{ .RelPermalink }}">{{ trim .Title " " }}</a>
-          {{ partial "post-language-switcher.html" . }}
-          {{ partial "post-info.html" . }}
-        </li>
+      <li>
+        <a href="{{ .RelPermalink }}">{{ trim .Title " " }}</a>
+        {{ partial "post-info.html" . }}
+      </li>
       {{ end }}
-      <ol>
+      {{ end }}
+    <ol>
   </section>
-  {{ else }}
+  {{ else if in .Params.categories "blog" }}
   <section class="feed">
+    <ol reversed>
+      {{ range sort .Pages "Date" "desc" }}
+      <li>
+        <time datetime="{{ .Date }}">{{ .Date.Format "2006-01-02" }}</time>:
+        <a href="{{ .RelPermalink }}">{{ trim .Title " " }}</a>
+        {{ partial "post-language-switcher.html" . }}
+        {{ partial "post-info.html" . }}
+      </li>
+      {{ end }}
     <ol>
+  </section>
+  {{ else }}
+  <section class="list">
+    <ul>
       {{ range sort .Pages "Date" }}
-        <li>
-          <a href="{{ .RelPermalink }}">{{ trim .Title " " }}</a>
-          {{ partial "post-language-switcher.html" . }}
-          {{ partial "post-info.html" . }}
-        </li>
+      <li>
+        <a href="{{ .RelPermalink }}">{{ trim .Title " " }}</a>
+        {{ partial "post-language-switcher.html" . }}
+        {{ partial "post-info.html" . }}
+      </li>
       {{ end }}
-      <ol>
+    <ul>
   </section>
   {{ end }}
 {{ end }}
diff --git a/layouts/_default/single.html b/layouts/_default/single.html
index 3dc85e7..d2d60dd 100644
--- a/layouts/_default/single.html
+++ b/layouts/_default/single.html
@@ -8,8 +8,8 @@ SPDX-License-Identifier: MIT
   <article>
     <header>
       <h1>{{ trim .Title  " " }}</h1>
-      {{ .WordCount }} words
-      ({{ div .WordCount 240}}~{{ div .WordCount 180}} minutes reading)
+      {{ i18n "word count" . }}
+      ({{ i18n "reading time" .ReadingTime }})
 
       {{ partial "post-language-switcher.html" . }}
       {{ partial "post-navigation.html" . }}