Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to copy subdirectories as-is in a Jekyll site

Tags:

jekyll

I have a website; some pages I maintain manually, some others, I generate using tools (mostly Shinx). For manually maintained pages, I'd like to migrate to Jekyll.

So my idea was to copy my whole website in a jekyll project, and progressively move pages from static HTML files to jekyll-managed markdown files, much easier to maintain. Generated pages, on the other hand, would be copied untouched.

It works pretty well... except that Jekyll does not copy the files starting with an underscore, which I have quite a lot: Sphinx names some special directories with a leading underscore (_static, _modules...), and I publish some python code, in which leading underscore are also used (e.g. __init__.py).

I know I could use the include directive in _config.yml, and add one by one all known files/directories that I want to keep. But I would still risk to miss some files (especially when my generators evolve).

I would rather be able to tell Jekyll, for each generated subdirectory, "this directory should be copied as-is". This would prevent it to look at every file in it to see if it should be processed, and so any file, starting with an underscore or not, would be blindly copied.

Is there a way to do that? I could not find any...

like image 972
Pierre-Antoine Avatar asked May 14 '14 20:05

Pierre-Antoine


People also ask

How do I copy all subdirectories?

If you want to copy directory, including all its files and subdirectories, use -R or -r option with cp command. The above command will create a destination directory and copy all files and subdirectories recursively to the /opt directory.

What is the _site folder in Jekyll?

the _site folder is useful only for local preview of your jekyll site (typically to be found at localhost:4000 by default). Save this answer. Show activity on this post.


1 Answers

The strategy I use (and, I assume, the strategy intended by the jekyll developers) is to have the generation tool (sphinx, yard, ...) generate directly into the output directory (e.g. _site/api) and add the resulting folder to the keep_files configuration option in _config.yml

like image 108
sylvain.joyeux Avatar answered Sep 21 '22 06:09

sylvain.joyeux