{{ $maxnum := .Site.Params.sidebar_maxnum }}
{{ $dir := .Site.Params.sidebar_url }}
{{ $.Scratch.Set "counter" 0 }}
{{ range $.Site.RegularPages }}
{{ if $StatBanner := and (eq .Params.mkbanner true) (le now .Params.bannerEndDate) }}
{{ $.Scratch.Set "counter" (add ($.Scratch.Get "counter") 1) }}
{{ if .Params.bannerimg }}
{{ else if .Params.image }}
{{ .Title }}
Posted on {{dateFormat "2 Jan, 2006" .Params.date }}
{{ else }}
{{ .Title }}
Posted on {{dateFormat "2 Jan, 2006" .Params.date }}
{{ end }}
{{ end }}
{{ end }}
{{ with $.Site.GetPage $dir }}
{{ range first $maxnum .Pages.ByDate.Reverse }}
{{$StatBanner := and (eq .Params.mkbanner false) (le now .Params.bannerEndDate) }}
{{ if eq $StatBanner true }}
{{ $.Scratch.Set "counter" (add ($.Scratch.Get "counter") 1) }}
{{ if le ($.Scratch.Get "counter") $maxnum }}
{{ if .Params.bannerimg }}
{{ else if .Params.image }}
{{ .Title }}
Posted on {{dateFormat "2 Jan, 2006" .Params.date }}
{{ else }}
{{ .Title }}
Posted on {{dateFormat "2 Jan, 2006" .Params.date }}