I have my code setup in the following fashion
{{$d := where (where (where .Params.featured_post.post_options "visible" true) "date" "le" time.Now ) "expiry_datetime" "ge" time.Now }}
{{$d}}
{{range $p := (where (where (where .Params.featured_post.post_options "visible" true) "date" "le" time.Now ) "expiry_datetime" "ge" time.Now )}}
{{ $data.Set "ftimage" $p.image }}
{{end}}
The results of $d in this case is :
[map[_option:custom date:2021-11-22 15:20:23 -0800 -0800 expiry_datetime:2022-11-22 15:20:23 -0800 -0800 image:/assets/uploads/blog-banner.jpg summary_text:summary text. title: Test Title url:/Test Feature visible:true]]
The $p will run over the range and do what I need.
However, When I switch to
{{$d := where (where (where .Params.featured_post.post_options "visible" true) "date" "le" time.Now ) "expiry_datetime" "ge" time.Now }}
{{range $d}}
{{ $data.Set "ftdate" $d.date }}
{{end}}
It doesn’t seem to range. Wondering what is happening here or a better explanation because I use an almost identical setup here that seems to work swimmingly:
{{range $p := $.Scratch.Get "featured_tags"}}
{{$pages := first $count (site.RegularPages.RelatedTo (keyVals "tags" $p )) }}
{{ range $p := $pages}}
{{$p.image}}
{{ end }}
{{end}}
Cheers,
Edit: Added relative toml frontmatter from index.md
featured_tags = [
"New Features",
"Events",
"Science"
]
[[featured_post.post_options]]
_option = "custom"
date = 2021-11-22T15:20:23-08:00
expiry_datetime = 2022-11-22T15:20:23-08:00
title = "Test Title"
visible = true
image = '/assets/uploads/blog-banner.jpg'
url = ‘/test’
summary_text= “””summary text.”””