diff --git a/themes/buha/layouts/index.html b/themes/buha/layouts/index.html index 8a6d1ba3..13d72cb1 100644 --- a/themes/buha/layouts/index.html +++ b/themes/buha/layouts/index.html @@ -6,9 +6,10 @@ {{ define "main" }} {{ $s := .Site.Params }} - {{- $posts := where (where .Site.RegularPages "Permalink" "!=" .Permalink) "Type" "in" $s.searchSections }} - {{- $featured := where (where $posts ".Params.featured" "=" true) "Type" "in" $s.searchSections }} - {{ $featured = where $featured ".Params.Lastmod" "gt" (now.AddDate 0 0 -14) }} + {{- $all := where (where .Site.RegularPages "Permalink" "!=" .Permalink) "Type" "in" $s.searchSections }} + {{ $featured := where (where (where $all ".Params.featured" "=" true) "Type" "in" $s.searchSections) ".Params.Lastmod" "gt" (now.AddDate 0 0 -14) }} + {{ $featured = $all | intersect $featured }} + {{ $posts := $all | complement $featured }} {{- $paginator := .Paginate $posts -}} {{ if eq $paginator.PageNumber 1 }} {{ if ne .Content "" }} @@ -18,12 +19,12 @@ {{ end }} {{ if gt (len $featured) 0 }}

{{if "featured" | i18n }}{{ "featured" | i18n }}{{ else }}{{ "Featured" }}{{ end }}

- {{ partial "contentlayouts/list.html" (dict "context" . "pages" $featured "amount" "3" "max_age" "14" "featured" "true") }} + {{ partial "contentlayouts/list.html" (dict "context" . "pages" $featured "amount" "3" ) }} {{ end }} {{ end }} {{ if gt (len $posts) 1 }}

{{ if "news" | i18n }}{{ "news" | i18n }}{{ else }}{{ "News" }}{{ end }}

- {{ partial "contentlayouts/list.html" (dict "context" . "paginator" $paginator "amount" "5" "max_age" "-14") }} + {{ partial "contentlayouts/list.html" (dict "context" . "paginator" $paginator "amount" "5") }}
{{ partial "structure/paginator" (dict "paginator" $paginator) }} diff --git a/themes/buha/layouts/partials/contentlayouts/list.html b/themes/buha/layouts/partials/contentlayouts/list.html index ddb41d9f..84a93f86 100644 --- a/themes/buha/layouts/partials/contentlayouts/list.html +++ b/themes/buha/layouts/partials/contentlayouts/list.html @@ -1,44 +1,23 @@ -{{ if or .paginator .pages }} - {{ if .amount }} - {{ $amount := .amount }} - {{ $pages := "" }} - {{ $max_age := int .max_age }} - {{ $featured := .featured }} - {{ if .pages }} - {{ $pages = .pages.ByLastmod.Reverse }} - {{ else if .paginator }} - {{ $pages = .paginator.Pages.ByLastmod.Reverse }} - {{ end }} - {{- range first $amount $pages -}} - {{ $true := true }} - - {{ if $featured }} - {{ if le (.Lastmod.AddDate 0 0 $max_age) now }} - {{ $true = false }} - {{ end }} - {{ else }} - {{ if $max_age }} - {{ if and (lt (.Lastmod.AddDate 0 0 $max_age) now) (eq .Params.featured true) }} - {{ $true = false }} - {{ end }} - {{ end }} - {{ end }} - {{ if eq $true true }} - {{ if .Title }} -
- -
-

{{- .Title -}}

-
-
- -
- {{ partial "contentlayouts/article.html" (dict "context" . "type" "list") }} -
-
-
- {{ end }} - {{ end }} - {{ end }} +{{ if and .amount (or .paginator .pages) }} + {{ $amount := .amount }} + {{ $pages := "" }} + {{ if .pages }} + {{ $pages = .pages.ByLastmod.Reverse }} + {{ else if .paginator }} + {{ $pages = .paginator.Pages.ByLastmod.Reverse }} + {{ end }} + {{- range first $amount $pages -}} +
+ +
+

{{- .Title -}}

+
+
+ +
+ {{ partial "contentlayouts/article.html" (dict "context" . "type" "list") }} +
+
+
{{ end }} {{ end }}