Ian Bicking
Ian Bicking

Reputation: 9922

Can I generate content in Jekyll from two different directories

I have two pieces of somewhat unrelated source that I want to turn into one "site" using Jekyll. But they are in two directories. Let's say PROJECT/site/ has the homepage and copy and so forth, and PROJECT/clientlib/ has a bunch of libraries. I'd like, for example, PROJECT/site/index.md to become /index.html and PROJECT/clientlib/foo.js to become /clientlib/foo.js

This is an open source project so I'd really like to avoid fooling around with symlinks or submodules that might make it harder for someone to check the project out and start using it. And I want to be able to use the Jekyll dev server, without doing fixup on the generated files.

Is there a way to configure (or hack) Jekyll to get the layout I'm hoping for?

Upvotes: 3

Views: 1235

Answers (2)

djsumdog
djsumdog

Reputation: 2710

I just finished publishing a custom gem that accomplishes this. It lets you specify a shared_dir that can be used between multiple Jekyll configurations for a common base:

https://github.com/sumdog/jekyll-multisite

Upvotes: 1

cboettig
cboettig

Reputation: 12687

You can give them the same destination path in your _config.yaml file (in place of the default _site, see https://github.com/mojombo/jekyll/wiki/Configuration

e.g.

destination: ../_site

but you will overwrite filenames, etc if they are duplicated between the two.

Upvotes: 0

Related Questions