Sign in
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.

Handlebars : CheckIf with multiple conditions / operator

  • This topic has 9 replies, 2 voices, and was last updated 1 month, 2 weeks ago by .
Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #10594
    Avatar photoAndy

    is it possible to do something like this?

    {{#each tags}}
    {{#checkIf id '!=' 1 || id '!=' 2 || id '!=' 3}}
    {{name}}
    {{/checkIf}}                     
    {{/each}}

     

    #10595
    Avatar photoTomasz Dziuda

    Hi,

    Currently it is not possible, but we will add in upcoming Publii v.0.43 two new features:

    – contains and notContains operator for checkIf:

    {{#checkIf id ‘notContains’ [1,2,3]}}

    – new handlebars helper – notContains:

    {{#notContains id “1,2,3”}}

    --
    Do you appreciate the support you've received today? If so, consider donating to the Publii team by clicking here; we'll be sure to use your donation to make Publii even better!

    #10604
    Avatar photoAndy

    Oh, cool! This could be a really good thing!

    thanks for the feedback 🙂
    Do you have any idea when this is planned?

    #10605
    Avatar photoTomasz Dziuda

    We will release Publii v.0.43 in nearest 1-2 weeks

    --
    Do you appreciate the support you've received today? If so, consider donating to the Publii team by clicking here; we'll be sure to use your donation to make Publii even better!

    #10606
    Avatar photoAndy

    Many Thanks !

    #10641
    Avatar photoAndy
    Tomasz Dziuda wrote:

    Hi,

    Currently it is not possible, but we will add in upcoming Publii v.0.43 two new features:

    – contains and notContains operator for checkIf:

    {{#checkIf id ‘notContains’ [1,2,3]}}

    – new handlebars helper – notContains:

    {{#notContains id “1,2,3”}}

    How many conditions will we be able to meet with this new version? Only 3? or as many as we want? thank you

    #10642
    Avatar photoTomasz Dziuda

    You can put as many values as you need 🙂

    The updated Publii files will be available at todays evening – official release info will be published after the weekend, so if you need this feature as soon as possible check out our download page at evening 🙂

    --
    Do you appreciate the support you've received today? If so, consider donating to the Publii team by clicking here; we'll be sure to use your donation to make Publii even better!

    #10643
    Avatar photoAndy

    Even better!

    it’s not urgent but I love testing new things! So I will!

    Thanks again for the feedback.

    PS: I’d like to use this with the source theme but I’ve discovered a bug in the theme (to filter tags) that I don’t know how to fix (see ticket: #25135)

    #11502
    Avatar photoAndy
    Tomasz Dziuda wrote:

    {{#checkIf id ‘notContains’ [1,2,3]}}

    Hello Tomasz,
    Have you implemented these helpers yet?
    I don’t see them in the documentation?

    Thank you

    #11503
    Avatar photoAndy

    And because I have this error :

    Rendering process failed
    An error (1002) occurred during parsing index.hbs file.

    Missing helper: “notContains”

     

    {{#each tags}}
                         {{#notContains id '1,2,3'}}
                            {{name}}
                            {{/notContains}}
                         {{/each}}

     

Viewing 10 posts - 1 through 10 (of 10 total)
  • You must be logged in to reply to this topic.