about summary refs log tree commit diff
path: root/layouts
diff options
context:
space:
mode:
authorNgô Ngọc Đức Huy <huyngo@disroot.org>2023-07-29 20:46:00 +0700
committerNgô Ngọc Đức Huy <huyngo@disroot.org>2023-07-29 20:46:00 +0700
commite75b69fd48bc953f6dfe2c65c1f70798da3b8adc (patch)
treed8542589a9658fc65417be363098c7b202a5be07 /layouts
parent8261eed6f8c2aeb2488a481f1d89ab9c8ff3a119 (diff)
downloadvictor-e75b69fd48bc953f6dfe2c65c1f70798da3b8adc.tar.gz
Use lang.Merge to avoid duplicates
Diffstat (limited to 'layouts')
-rw-r--r--layouts/_default/list.html8
1 files changed, 5 insertions, 3 deletions
diff --git a/layouts/_default/list.html b/layouts/_default/list.html
index 7c774d5..bdcd630 100644
--- a/layouts/_default/list.html
+++ b/layouts/_default/list.html
@@ -9,16 +9,18 @@ SPDX-License-Identifier: MIT
     {{ .Content }}
   </section>
   {{ if in .Params.categories "book" }}
+  {{ $chapters := .Page.Pages }}
+  {{ range .Page.Translations }}
+    {{ $chapters = $chapters | lang.Merge .Pages }}
+  {{ end}}
   <section class="toc">
     <ol>
-      {{ range .Page.Translations | append .Page }}
-      {{ range sort .Pages "Weight" }}
+      {{ range sort $chapters "Weight" }}
       <li>
         <a href="{{ .RelPermalink }}">{{ trim .Title " " }}</a>
         {{ partial "post-info.html" . }}
       </li>
       {{ end }}
-      {{ end }}
     <ol>
   </section>
   {{ else if in .Params.categories "blog" }}