Download
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.

Example not working for me. How to sense what template I am using?

  • #5371
    Avatar photo[anonymous]

    I am trying to use…

    {{#checkIf template '==' "MYTEMPLATE"}}

    …but am not sure what value to use.

    Cuurently, I have one head partial per post index, author, post, tag as index-head.hbs, author-head.hbs, and so on.

    I am trying to create a single head.hbs where I can sense which template I am using and changing the contents within a div tag.

    I have tried post, post-head, post.hbs, post-head.hbs as examples.

    None of these seem to work.

    I also see…

    {{template}}

    and within a…

    {{#post}} {{/post}

    … returns nothing. I used this to try and figure out what value I should use in the checkIf example.

    No such luck-

    Are there any clues as to what should replace MYTEMPLATE to sense if the template is index, post, author, or tag?

    Cheers!!

    #5374
    Avatar photo[anonymous]

    I believe you can use the {{#is}} helper.

    Have a look at https://getpublii.com/dev/is-helper/#is-helper

    #5375
    Avatar photo[anonymous]

    Cheers Mate!!

    Brilliant!

    I will give this a shot in the AM. (Yes I know it is already the AM.) 😉