Menu icon Foundation
Nested pages with Panini

I have a prototype with dozens of pages. Half of them use one type of layout, another half uses another layout. 

How do I create nested pages? I tried creating subfolders

/src/pages/subfolder/subpage

but 

{{> subfolder/subpage}}

does not work. I can’t use partials, too, because each of these pages needs it’s own url. 

How do I create nested views?

panini

I have a prototype with dozens of pages. Half of them use one type of layout, another half uses another layout. 

How do I create nested pages? I tried creating subfolders

/src/pages/subfolder/subpage

but 

{{> subfolder/subpage}}

does not work. I can’t use partials, too, because each of these pages needs it’s own url. 

How do I create nested views?

Nik Sol 11 days ago

Hello Sven,

I might be wrong, but I think the best solution for you would be to do it like this. Put all your prototype pages here:

/src/partials/sufolder/

After if you just need to keep the content in sync with the content here:

/src/pages/subfolder/

You can either use a software that would always keep these folders in sync (if the content is constantly changed) or you can just copy paste once you finish working on the files.

I am not sure if this is the only solution, but it works.

Bests!

Sven 10 days ago

Hardlink sounds better than copying files, though. Still very hacky solution, though. 

Mabye there’s something in Handlebars.js? 

Negativefix 7 days ago

I don't think I understand the question. Do you want to choose which layout to use for a specific page or pages? 

Sven 7 days ago

Let’s say I have 15 pages that have top bar and 15 pages that have off-canvas menu on the left (public-facing website and app itself). 

How do set up this with Panini? I thought I just create two folders so I can just link into them in my main page template

/src/pages/website/page_n

/src/pages/app/page_n

But it seems Handlebars can’t read all files in a folder.

Negativefix 7 days ago

I would create two layouts;

  1. A layout with offcanvas - layouts/default.html
  2. A layout with topbar - layouts/default-w-topbar.html

I would keep pages folder structure flat (I mean you dont need to create subfolders);

  1. page A 
  2. page B
  3. page C - lets say this page must use the layout with topbar -  layouts/default-w-topbar.html

In page C and all the other pages that should have topbaradd the following lines at the top of the file;

---
layout: default-w-topbar
---

layout is a page variable that stores the name of the layout to use. In this case all the pages containing the above lines will be using layout with topbar.

 

 

Sven 7 days ago

Thanks a thousand, Negativefix!

My day is saved.