foundation / panini

A super simple flat file generator.
Other
592 stars 104 forks source link

pageLayouts for multiple folders inside folder #210

Open babarogic opened 4 years ago

babarogic commented 4 years ago

How to achieve with panini to put specific layout for specific pages/folders. For now i achieved to point as in documentation provided folder blog to blog layout. But panini does not goes deeper and points layout to other folders inside folders. How to achieve that?

It goes something like this but not successful

pageLayouts: {
        'product': 'product',
        'product/folder2/': 'product',
        'product/folder3/': 'product',
        'kontakt': 'kontakt'
      }

folder2 and folder3 are pointed to defauly layout rather not to product layout

kolejakjozef commented 4 years ago

@babarogic i needed this solution today, and i figured it out. This way it works for me on windows environment: pageLayouts: { 'product': 'product', 'product\\folder2': 'product', 'product\\folder3': 'product', 'kontakt': 'kontakt' }

babarogic commented 4 years ago

@kolejakjozef Awesome! Here is another solution, in html pages, just call this on the beginning and it will use the layout you assignee to

---
layout: name-of-layout
---
TolyanDimov commented 3 years ago

Help: How can you create two partials directories?

.pipe(panini({
  ...
  partials: srcRoot + appDir + '/components/',
  partials: srcRoot + appDir + '/modules/',
  ...
}))

For example: if in the partials folder, place the components and modules folders. A problem arises when the html file has the same name in both folders.

LitvinenkoEvgeny commented 3 years ago

@TolyanDimov as i can see, you can't because https://github.com/foundation/panini/blob/develop/lib/loadPartials.js#L11 loadPartials function apply only one directory