[SOLVED] Indexing posts with a specific Params in post_x.md (Solution: use nested 'where' functions)


#1

I want to only show posts that have a true value for the index parameter:

+++
index = "true"
+++

How should I place .Params.index in the {{ range ... }}?
or how should I filter the list for .Params.index before {{ range ... }}?

UPDATE: Take a look at https://gohugo.io/functions/where/#nest-where-clauses for solution.


#2

I’m not sure, but, index already has meaning, so if you try to make a variable out of it like this, it could cause trouble.

(Edit: removed reference to with because as @bep points out where makes sense here, sorry)


#3

No, that is not an issue in this case.

@Rea you need to look at the where func – it should be plenty of examples both in the documentation and here on the forum.


#4

Well noted, thanks


#5

Thanks. Solved by using ‘Nest where Clauses’.