Menu icon Foundation
F6 Panini Handlebars help

Ok, so i have been watching the recent panini youtube videos, and I am loving them. I am designing a one page and I have created a partial called section headers, what I would like to do is insert the section headers titles from a YML file. So I have set that up.

So what I want is the first time the section header partial appears I want it to insert the first title item in the array, and then the second time I want it to insert the second item in the array and so forth. 

If i use the #each then every time the section header partial appears it places all of the array items on the page.

Is there anyway to do this? Is it even a good idea?

Thanks for any help.

 

Section headers partialpage structureyml

panini handlebars yml help Rafi Benkual

Ok, so i have been watching the recent panini youtube videos, and I am loving them. I am designing a one page and I have created a partial called section headers, what I would like to do is insert the section headers titles from a YML file. So I have set that up.

So what I want is the first time the section header partial appears I want it to insert the first title item in the array, and then the second time I want it to insert the second item in the array and so forth. 

If i use the #each then every time the section header partial appears it places all of the array items on the page.

Is there anyway to do this? Is it even a good idea?

Thanks for any help.

 

Section headers partialpage structureyml

Rafi Benkual over 2 years ago

Dan - glad you're loving the videos!

 

So to help us understand, you want to create a different title for each partial section-headers-level-1?

I would probably create a different name for each, based on the content it's describing:

section-titles-home:
  -
    section-title-case: Case Studies
  -
    section-title-video: Video Preview

This type of abstraction might not be worth the benefit unless i'm missing the use case.

Dan Billinghan over 2 years ago

Hej Rafi - Thanks for getting back to me.

If i give each one their own name, how do I call them in if I just have {{section-title}} in the partial?

I am probably making a meal out of it - i'm pretty good at that!

But what I was hoping to achieve was to be able to set up one partial for my section headers and then call in the appropriate titles as and when needed. This could mean that the partial is used more than once on the same page, or/and that it is used on different pages. 

Thanks again.