diff options
author | Ngô Ngọc Đức Huy <huyngo@disroot.org> | 2023-07-29 20:46:00 +0700 |
---|---|---|
committer | Ngô Ngọc Đức Huy <huyngo@disroot.org> | 2023-07-29 20:46:00 +0700 |
commit | e75b69fd48bc953f6dfe2c65c1f70798da3b8adc (patch) | |
tree | d8542589a9658fc65417be363098c7b202a5be07 | |
parent | 8261eed6f8c2aeb2488a481f1d89ab9c8ff3a119 (diff) | |
download | victor-e75b69fd48bc953f6dfe2c65c1f70798da3b8adc.tar.gz |
Use lang.Merge to avoid duplicates
-rw-r--r-- | layouts/_default/list.html | 8 |
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" }} |