panini icon indicating copy to clipboard operation
panini copied to clipboard

pageLayouts for multiple folders inside folder

Open babarogic opened this issue 5 years ago • 4 comments
trafficstars

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

babarogic avatar Mar 06 '20 09:03 babarogic

@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' }

kolejakjozef avatar Sep 16 '20 09:09 kolejakjozef

@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
---

babarogic avatar Sep 17 '20 17:09 babarogic

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.

TolyanDimov avatar Dec 18 '20 04:12 TolyanDimov

@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

LitvinenkoEvgeny avatar Jul 14 '21 12:07 LitvinenkoEvgeny