Questions on how to stop jekyll from deleting files

This probs has been asked a lot before, but I simply couldn’t find an answer myself, so I’m asking anyways…

First some context.
I have a repository for hosting files for my website and one for hosting my blog. While the website uses jekyll is the blog using another software for various reasons.

I do have a setup that automates the building process for the website and also the blog itself. For this question is only the website one important, which you can find here

From what I understand is jekyll cleaning the _site directory when building (or serving) the site. This would also include the blog folder generated and added by the blog repository.

My question now is, what would be the right configuration within jekyll to prevent it from deleting this folder, if that is doable.

I’ve seen from some google searches that there is the keep_files: [DIR, FILE, ...] option, but I have 2 problems with it.

  1. It’s not entirely clear to me on what the syntax for a folder would need to be here. Is it just blog or would I need to include a trailing / to indicate a folder rather than a file?
  2. From further searching does it seem like this option works reliable or as assumed it would? Seen a few posts reporting files still being deleted despite being defined in the option.

So… yeah. What’s the right configuration here?
The _config.yml I currently use is found here

jekyll will delete everything from the _site folder when you do build or serve - unless you use keep_files to tell it not to.

you should be able to use keep_files: [blog] -no trailing slash or anything needed.

I used to use gulp to handle css and assets within a jekyll site so I needed to keep jekyll from deleting the assets folder that gulp was making for me. Here is a link to just that part of the video where I show my setup - I never had any issues with it.

1 Like

That indeed seems to work. Thank you.