Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/chipzoller/hugo-clarity.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Hong <luke0724@hotmail.com>2022-07-25 20:22:48 +0300
committerLuke Hong <luke0724@hotmail.com>2022-07-27 11:24:53 +0300
commite1d52af448aba8d8f6b5ed6c7f47085740487d7e (patch)
tree9ccaf155edde1a3e4599cb884574112a1af90aa3 /layouts
parent6d90564fef2c4d6783b1e7bfbf2105f81301760e (diff)
Add pinning featured posts option
Signed-off-by: Luke Hong <luke0724@hotmail.com>
Diffstat (limited to 'layouts')
-rw-r--r--layouts/partials/archive.html7
1 files changed, 7 insertions, 0 deletions
diff --git a/layouts/partials/archive.html b/layouts/partials/archive.html
index 2ba56e4..9f02449 100644
--- a/layouts/partials/archive.html
+++ b/layouts/partials/archive.html
@@ -2,6 +2,13 @@
{{ if .IsHome }}
{{ $pages = where site.RegularPages "Type" "in" site.Params.mainSections }}
{{ end }}
+
+{{ if eq site.Params.pinFeatured true }}
+ {{ $featured := default 8 site.Params.numberOfPinnedPosts }}
+ {{ $featuredPosts := first $featured (where $pages "Params.featured" true)}}
+ {{ $normalPosts := $pages | symdiff $featuredPosts }}
+ {{ $pages = $featuredPosts | append $normalPosts }}
+{{ end }}
<div class="grid-inverse wrap content">
<div>
<ul class="posts" id="posts">