We're evolving to serve you better! This current forum has transitioned to read-only mode. For new discussions, support, and engagement, we've moved to GitHub Discussions.

Add Eval helper or allow loop logic in some Publii helpers.

  • #7380
    Avatar photo[anonymous]

    In this post, I tried to used

    {{#checkIf (getPostsByTags (concatenate "count=999&tag_as=slug&tags=vacancy&excluded=0&offset=0&orderby=modifiedAt&ordering=asc")) '==' false}}

    to determine if the case was true or not. In some respect it did work though not completely.

    The checkIf statement did indeed return true or false as I hoped. However, there is just one problem.

    It appeared as if the use of the getPostsByTags in this manner remained as an open block meaning that no /getPostsByTags existed. As a result, getPostsByTags would not work anywhere else.

    It appears that getPostsByTags (et al.) does not allow for the same logic we see in other loops such as checkIf. For example, else. I would not have tried the code above if the loop logic existed for getPostsByTags.

    I can see how adding an Eval helper can allow for testing a condition. I imagine that a checkIf that closes the call as in my example could suffice.

    Alternatively, adding logic to getPostsByTags (et al.) we see in other loop logic helpers would also help.

    While I have yet to actually use Publii for a website, I am creating several sites that will go live at some point. I am an enthusiastic supporter of Publii. It is so incredibility user friendly while offering extensive options for developers. It is so very professionally developed that I can see the amazing effort you have put into this. This is a tool that so many people could use regardless of their skill level. When I finally finish one website, I intend to contribute and contribute again as each additional site is deployed. I appreciate your product. It makes me happy to see it.