Filtering posts on index

Right now I am iterating over the list of posts on my index page using: {{#foreach posts visibility="all"}} and my question is are there other filters that I can pass to the foreach that can be used to filter the posts? And is there any documentation for this visibility parameter? I don’t see it documented either here or here.

Foreach is a context aware helper so the fields depend on the context you are in (post, tag, author).
You can see the available fields in the post context here

Additionally there are also some data variables available in a foreach about the current iteration:

  • @index (number) - the 0-based index of the current iteration
  • @number (number) - the 1-based index of the current iteration
  • @key (string) - if iterating over an object, rather than an array, this contains the object key
  • @first (boolean) - true if this is the first iteration of the collection
  • @last (boolean) - true if this is the last iteration of the collection
  • @odd (boolean) - true if the @index is odd
  • @even (boolean) - true if the @index is even
  • @rowStart (boolean) - true if columns is passed and this iteration signals a row start
  • @rowEnd (boolean) - true if columns is passed and this iteration signals a row end

Gotcha. Is there any documentation about the context aware filtering that foreach does? For example, a value of all to visibility seems to have special meaning as all is not one of the values that visibility can take. (I assume all means any value but was wondering if / where this is documented).

Further is it possible to filter by either tag or primary_tag when using the foreach on the list of posts? I am looking to add some tag specific lists to the index page (like Melaka does).