"where" using date comparisons - appreciate a hint

I’m trying to get a range of pages where lastmod is later than a Unix date that I specify in site frontmatter.

  • Range on $test1 gives me the expected pages, with expected Unix date integers : OK
  • Range on $test2 is always empty, no matter how I mess around with the where operators :frowning:
{{ $test1 := ( site.Pages.ByLastmod | last 12).Reverse }}
{{ range $test1 }}
  <p> #1  Date {{ .Lastmod.Unix }} updatebase {{ site.Params.updatebase }} {{.Title }}</p>
{{ end }}
{{ $test2 := ( ( where site.Pages.ByLastmod .Lastmod.Unix "gt" site.Params.updatebase )| last 12).Reverse }}
{{ range $test2 }}
  <p> #2 Date {{ .Lastmod.Unix }} updatebase {{ site.Params.updatebase }} {{.Title }}</p>
{{ end }}

I’m sure it must be simple. but I cannot see it…
Thanks so much for a hint.

where takes the following input:

where COLLECTION KEY [OPERATOR] MATCH

so it takes .Unix as part of the map key, instead of performing that function on .Lastmod, as in the example in the docs with Params.series.

Try instead something like:

{{ $ud := time site.Params.updatebase }}
{{ $test2 := ( (where site.Pages.ByLastmod "Lastmod" "gt" $ud) | last 12 ).Reverse }}

That’s it!!

Thank you, I was not looking in that direction and it would have taken me a loooong time without your help!