1

I bought a simple Jekyll template for a support site and have that up and running no issues.

I am trying to render my existing docs collection with separate layout. For background I am taking these docs and making a stripped down html file that has just the body content to use in a small modal pop-up window.

In my config file I have this:

defaults:
  # _docs
  -
    scope:
      path:         ""
      type:         docs
    values:
      layout:       doc

which renders my regular HTML files fine along with all my other template content in the target directory.

I am looking to also process this:

defaults:
  # _docs
  -
    scope:
      path:         ""
      type:         docs
    values:
      layout:       modal

The issue is that it seems in Jekyll can't do this out of the box. If add this to my config file it only uses the last one. If I try multiple config files they over write each other. I just want my full HTML docs using the doc layout in /docs and the HTML partial files rendered with the same docs collection using the modal layout in /modals as detailed in my previous post Multiple layouts for a single Jekyll collection?.

What I would like to do now is make a separate config file that builds ONLY the docs (using the modals layout) and NOT any of the other files (index, search, posts, 404 etc.) - just the docs collection with the alternate layout. I want the target folder to be the /modals sub directory of my main Jekyll.

Dan Tappin
  • 2,692
  • 3
  • 37
  • 77
  • How are you deploying your site? Since Jekyll overwrites the content of your destination folder with every build, it'll be difficult to achieve everything being put in the same directory by Jekyll. However, if you deploy yourself (FTP, Rsync,...) you could get this done by having separate destination folders for each build and then deploying them into the same directory on your server. Let me know if this is an option and I'll elaborate my solution. – Simon Oct 09 '20 at 17:53
  • I am building it locally in my Rails app public folder then merging into my main app codebase. Adding my pseudo solution shortly. – Dan Tappin Oct 13 '20 at 16:13

1 Answers1

0

This my hack so far - I won't even accept my own answer as it's not really a solution:

I have a second identical config file with this:

keep_files: ["docs"]

collections:
  docs:
    output:         true
    permalink:      /modals/:name

I run this after the running the main config file. Keeps the normal docs build then adds the custom modal version.

Dan Tappin
  • 2,692
  • 3
  • 37
  • 77