diff options
author | Ivan Boothe <git@rootwork.org> | 2022-07-27 01:27:01 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-27 01:27:01 +0300 |
commit | a291123d1994653fa322f8f3c648feeee890946b (patch) | |
tree | fc206f0f90db2f2e2ff20f78e2fb3b2ec7d482c9 | |
parent | 6d90564fef2c4d6783b1e7bfbf2105f81301760e (diff) | |
parent | 5086aeb56d8bdbdf5e2c8cfba4762ed2b97481a9 (diff) |
Merge pull request #352 from LukeHong/deduplicate_sidebar_list
-rw-r--r-- | layouts/partials/sidebar.html | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/layouts/partials/sidebar.html b/layouts/partials/sidebar.html index 30fd676..17b18b2 100644 --- a/layouts/partials/sidebar.html +++ b/layouts/partials/sidebar.html @@ -34,11 +34,11 @@ {{- end }} {{ if .Site.Params.sidebardisclaimer }} - <div class="sidebardisclaimer"> - <h2 class="mt-4">Disclaimer</h2> + <div class="sidebardisclaimer"> + <h2 class="mt-4">Disclaimer</h2> {{ .Site.Params.disclaimerText }} - </div> - {{ end }} + </div> + {{ end }} {{- $relatedInSidebar := true }} {{- if eq $s.showRelatedInSidebar false }} @@ -56,9 +56,10 @@ </ul> {{ end }} - {{- $posts := where (where .Site.RegularPages "Permalink" "!=" .Permalink) "Type" "in" $s.mainSections }} + {{- $posts := where .Site.RegularPages "Type" "in" $s.mainSections }} {{- $featured := default 8 $s.numberOfFeaturedPosts }} - {{- with first $featured (where $posts "Params.featured" true)}} + {{- $featuredPosts := first $featured (where $posts "Params.featured" true)}} + {{- with $featuredPosts }} <h2 class="mt-4">{{ T "featured_posts" }}</h2> <ul> {{- range . }} @@ -71,7 +72,7 @@ <h2 class="mt-4">{{ T "recent_posts" }}</h2> <ul class="flex-column"> {{- $recent := default 8 $s.numberOfRecentPosts }} - {{- range first $recent $posts }} + {{- range first $recent $posts | symdiff $featuredPosts }} <li> <a href="{{ .Permalink }}" class="nav-link" title="{{ .Title }}">{{ .Title | markdownify }}</a> </li> |