Hi,
I have some troubles with the where function. I’m listing a list of seismic event based on a param :
content/events/2343/index.en.md
{
"automatic": false,
"eventType": "earthquake",
"id": 2343,
"latitude": -39.42,
"longitude": 173.3,
"magnitude": 5.6,
"magnitudeType": "mb",
"publishDate": "2013-02-16T05:15:33.659999Z",
"timezone": "Pacific/Auckland",
"url": "/en/events/2343",
"zones": [
"monde"
]
}
eventType can be equal to “quarryblast”, “earthquake” and so on.
I try in my template to filter on this parameters with the following code :
{{ $limit := 40 }}
{{ $last_events := first $limit .Data.Pages }}
{{ $earthquakes := where $last_events "Params.eventType" "eq" "earthquake" }}
I’ll get an empty array while if I range over $last_events :
{{ range $last_events }}
<p>{{ .Params.eventType }}</p>
{{ end }}
I get a list
quarry blast
induced
explosion
earthquake
earthquake
earthquake
earthquake
quarry blast
quarry blast
quarry blast
earthquake
earthquake
quarry blast
What I’m doing wrong ? I also tried with “.Params.eventType” :
{{ $earthquakes := where $last_events ".Params.eventType" "eq" "earthquake" }}
But that changed nothing ;/
Thank you for your help in advance ! I’m starting to loose my mind