Menu icon Foundation
Custom panini helpers

Hi,

I'd like to create a custom handlebars Panini helper similarly to how "#ifequal" works, but for sections instead.

For example, I want to include some json data content into section A, then a different data content into section B, both on the same page.

How can I go about writing my JS file to do so?

sitescustom helpershelperspaninisectionifequal

Hi,

I'd like to create a custom handlebars Panini helper similarly to how "#ifequal" works, but for sections instead.

For example, I want to include some json data content into section A, then a different data content into section B, both on the same page.

How can I go about writing my JS file to do so?

Rafi Benkual about 1 month ago

Not sure how to do that but you can create separate data variables for the content and new objects for each block.

SVM about 1 month ago

Thanks Rafi for the reply. I would like to keep the data variables in a single file (especially since the data content are of the same type). I have used the #ifpage helper and see that it's written like so on this page: https://github.com/zurb/panini/blob/master/helpers/ifPage.js

I know that there's #ifequal helper as well, but that doesn't seem to work to look for css classes. I'm curious if this example can be written into a custom handelbars helper to look for <section> tags or use css classes? Can you provide an example of how this could work or be written?