diff options
author | Luke Hong <luke0724@hotmail.com> | 2022-07-25 19:20:29 +0300 |
---|---|---|
committer | Luke Hong <luke0724@hotmail.com> | 2022-07-26 22:17:45 +0300 |
commit | f61fcfff8565577a1777387e39281aa5caee99fa (patch) | |
tree | ac2468959094c3ca97e1279c19fdf91ab812c437 | |
parent | 6d90564fef2c4d6783b1e7bfbf2105f81301760e (diff) |
Hide duplicated posts
Signed-off-by: Luke Hong <luke0724@hotmail.com>
-rw-r--r-- | layouts/partials/sidebar.html | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/layouts/partials/sidebar.html b/layouts/partials/sidebar.html index 30fd676..5d8970c 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 }} @@ -58,7 +58,8 @@ {{- $posts := where (where .Site.RegularPages "Permalink" "!=" .Permalink) "Type" "in" $s.mainSections }} {{- $featured := default 8 $s.numberOfFeaturedPosts }} - {{- with first $featured (where $posts "Params.featured" true)}} + {{- $featured_posts := first $featured (where $posts "Params.featured" true)}} + {{- with $featured_posts }} <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 $featured_posts }} <li> <a href="{{ .Permalink }}" class="nav-link" title="{{ .Title }}">{{ .Title | markdownify }}</a> </li> |