Sign in

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

  • This topic has 0 replies, 1 voice, and was last updated 1 year, 1 month ago by Avatar photopublii-slpa.
Viewing 1 post (of 1 total)
  • Author
    Posts
  • #7380
    Avatar photopublii-slpa

    In this post, https://forum.getpublii.com/topic/how-to-know-if-there-are-no-posts-using-getpostsbytags-sigh-again/ 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.

    Cheers!!

Viewing 1 post (of 1 total)
  • You must be logged in to reply to this topic.