From 0171364c21c27a6a27bfc52adc0d07c7adb9142f Mon Sep 17 00:00:00 2001 From: Livia Date: Tue, 8 Apr 2025 16:02:10 +0200 Subject: [PATCH] custom layout fpr homepage, hardcode 2025 in query --- layouts/index.html | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 layouts/index.html diff --git a/layouts/index.html b/layouts/index.html new file mode 100644 index 0000000..c9b9810 --- /dev/null +++ b/layouts/index.html @@ -0,0 +1,45 @@ +{{ define "main" }} +
+ {{ .Content }} +
+ + {{/* Define section to pull recent posts from */}} + {{ $mainSections := site.Params.mainSections | default (slice "post") }} + {{ $show_recent_posts := site.Params.ananke.show_recent_posts }} + + {{/* First filter by section, then by year */}} + {{ $filteredBySection := where $.Site.RegularPages "Section" "in" $mainSections }} + {{ $section := where $filteredBySection "Date.Year" 2025 }} + {{ $section_count := len $section }} + + {{ if and ($show_recent_posts) (ge $section_count 1) }} +
+ {{ $n_posts := $.Param "recent_posts_number" | default 3 }} + +
+ {{/* Range through the first $n_posts items of the section */}} + {{ range (first $n_posts $section) }} +
+ {{ .Render "summary-with-image" }} +
+ {{ end }} +
+ + {{ if ge $section_count (add $n_posts 1) }} +
+

{{ i18n "more" }}

+ {{/* Now, range through the next four after the initial $n_posts items. Nest the requirements, "after" then "first" on the outside */}} + {{ range (first 4 (after $n_posts $section)) }} +

+ + {{ .Title }} + +

+ {{ end }} +
+ {{ end }} + +
+ {{ end }} +{{ end }} +