By default, Jekyll includes into the website whatever exists at the project root minus some files and directories that has special meanings.
my_jekyll_site |- GemFile // safe by default |- GemFile.lock // safe by default |- _config.yml // safe by default |- .gitignore // safe by default |- index.md // included |- _posts // included (parsed and then included) |- ...
There is one problem with this setup. If you add a script file here, you are going to expose that file!
my_jekyll_site |- Gemfile |- ... |- script.sh // uh oh, you're exposing this file!
There can be multiple reasons for creating a non-Jekyll related scripts, examples being:
- Automated build script for the server to publish your site
You could specify
exclude key in your
_config.yml, but this is merely a manual denylist - you may forget to add stuff until it is too late.
There is even better way:
This tells Jekyll to stop looking at the project root for the content to build; instead, it will use the directory you have specified.
In this example, you put everything into
_src directory and everything will work just as fine. No more need to update your
One small notice is if you're generating stuff outside of Jekyll, e.g., transpiling your typescript, you need to point the input and output into the