Listing content based on Front Matter variable

Hi,

I have different types of content that are geolocalized. Say, I have an article about Paris, in my front matter I have the following varaible “basedIn: france” .

I also have country pages where these types of content are collected. The page “france.html” will collect all the and that are located in France. In the front matter, I have “country : france”

I have tried several things to get that behavior, but couldn’t find the way to do it.
I was assuming that something like this would work for the template used on the page paris.html :

{{ range (where .Site.Recent .Params.basedIn .Params.country ) }}
    {{ .Title }}      
{{ end }}

By hacking a bit my content, I got the feeling that the .Params.basedIn part was not recognized, whereas the .Params.country was correct.

My guess is that the where instruction does not look up into front matter variables… am I wrong?

You’re right, Where doesn’t consider params.

But @spf13 mentioned in another thread that it should – and I guess it’s on @tatsushid’s list of improvements.

Thanks. That’s great to know.

This should be fixed in

1 Like