forked from Bunteshaus/bunteshaus.de
small fixes
This commit is contained in:
parent
52da0b8919
commit
f5944d423c
|
@ -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 }}
|
||||
<a href="/featured"><h2>{{if "featured" | i18n }}{{ "featured" | i18n }}{{ else }}{{ "Featured" }}{{ end }}</h2></a>
|
||||
{{ 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 }}
|
||||
<a href="/news"><h2>{{ if "news" | i18n }}{{ "news" | i18n }}{{ else }}{{ "News" }}{{ end }}</h2></a>
|
||||
{{ partial "contentlayouts/list.html" (dict "context" . "paginator" $paginator "amount" "5" "max_age" "-14") }}
|
||||
{{ partial "contentlayouts/list.html" (dict "context" . "paginator" $paginator "amount" "5") }}
|
||||
|
||||
<div id="pagination_outer" style="display: flex; justify-content: center;">
|
||||
{{ partial "structure/paginator" (dict "paginator" $paginator) }}
|
||||
|
|
|
@ -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 }}
|
||||
<article class="articlebgcol1 borderrad25">
|
||||
<a href="{{- .Permalink -}}">
|
||||
<div id="articletitle">
|
||||
<h2>{{- .Title -}}</h2>
|
||||
</div>
|
||||
</a>
|
||||
<a href="{{- .Permalink -}}">
|
||||
<div id="articlecontent">
|
||||
{{ partial "contentlayouts/article.html" (dict "context" . "type" "list") }}
|
||||
</div>
|
||||
</a>
|
||||
</article>
|
||||
{{ 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 -}}
|
||||
<article class="articlebgcol1 borderrad25">
|
||||
<a href="{{- .Permalink -}}">
|
||||
<div id="articletitle">
|
||||
<h2>{{- .Title -}}</h2>
|
||||
</div>
|
||||
</a>
|
||||
<a href="{{- .Permalink -}}">
|
||||
<div id="articlecontent">
|
||||
{{ partial "contentlayouts/article.html" (dict "context" . "type" "list") }}
|
||||
</div>
|
||||
</a>
|
||||
</article>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
|
Loading…
Reference in New Issue
Block a user