From c8ac437b099af2ad53101e7dd9feee8636c2f12b Mon Sep 17 00:00:00 2001 From: razonyang Date: Mon, 30 Oct 2023 11:46:59 +0800 Subject: [PATCH] feat: add the carouselPostCount parameter which indicates the number of posts on homepage carousel --- config.toml | 1 + layouts/partials/carousel.html | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/config.toml b/config.toml index 5476f9cf1..a4e0a0b8b 100644 --- a/config.toml +++ b/config.toml @@ -11,6 +11,7 @@ color = "auto" customCSS = [] customJS = [] diagram = false +carouselPostCount = 5 featuredPostCount = 5 fixedHeader = true fullWidth = false diff --git a/layouts/partials/carousel.html b/layouts/partials/carousel.html index 9aebfe587..69779ffb1 100644 --- a/layouts/partials/carousel.html +++ b/layouts/partials/carousel.html @@ -1,4 +1,5 @@ -{{- $pages := first 3 (where $.Site.Pages "Params.carousel" true) }} +{{- $count := default 5 site.Params.carouselPostCount }} +{{- $pages := first $count (where $.Site.Pages "Params.carousel" true) }} {{- if and .IsHome $pages (eq .Paginator.PageNumber 1) }}