From 143eb18b756e051641664aca1a9538b52e2f4516 Mon Sep 17 00:00:00 2001 From: Aditya Telange <21258296+adityatelange@users.noreply.github.com> Date: Wed, 10 Feb 2021 20:58:08 +0530 Subject: [PATCH] handle case where home-info was hidden when num of posts = 0 - fix: #227 - refactor conditions for nested if - also fix for 082d960 --- layouts/_default/list.html | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/layouts/_default/list.html b/layouts/_default/list.html index 30b1527..bf87ef9 100644 --- a/layouts/_default/list.html +++ b/layouts/_default/list.html @@ -16,6 +16,10 @@ {{- end }} +{{- if and .IsHome .Site.Params.homeInfoParams (eq .Paginator.PageNumber 1) }} +{{- partial "home_info.html" . }} +{{- end }} + {{- $pages := union .RegularPages .Sections }} {{- if .IsHome }} @@ -27,15 +31,14 @@ {{- range $index, $page := $paginator.Pages }} {{- $class := "post-entry" }} -{{- if (and $.IsHome (eq $paginator.PageNumber 1) (eq $index 0)) }} -{{- if .Site.Params.homeInfoParams | or .Site.Params.disableSpecial1stPost}} -{{- partial "home_info.html" . }} -{{- else}} + +{{- $user_preferred := or .Site.Params.disableSpecial1stPost .Site.Params.homeInfoParams }} +{{- if (and $.IsHome (eq $paginator.PageNumber 1) (eq $index 0) (not $user_preferred)) }} {{- $class = "first-entry" }} -{{- end }} {{- else if $term }} {{- $class = "post-entry tag-entry" }} {{- end }} +
{{- $isHidden := (.Site.Params.cover.hidden | default .Site.Params.cover.hiddenInList)}} {{- partial "cover.html" (dict "cxt" . "IsHome" true "isHidden" $isHidden) }} @@ -72,4 +75,4 @@ {{- end }} {{end}}{{/* end profileMode */}} -{{- end }}{{- /* end main */ -}} +{{- end }}{{- /* end main */ -}}