We have looked at how to get your Jekyll site up and running. In some cases, you need to have a directory on your site that starts with a “.” – usually, some system item requires it. By default, when Jekyll is building your site, it will ignore directories in the root of your Jekyll project that start with a “.” and uses directories that start with an “_” as inputs for building the site.
The solution to this lies in changing the _config.yml
and adding a variable called include
which specifies that the .directory is to be included in your site. The example on the configuration page shows that a good use case for using this option is to include files such as .htaccess
in your site – we use the same.
Edit the _config.yml
file to include the name of the directory. For example, if the path you want to include into your site is called .directory
add a line like this into the _config.yml
include: ['.directory']
If the line already exists and you want to add another directory (e.g. .dir2) or file (.htaccess), ensure that it is in quote marks inside the box brackets. So, it would become something like this:
include: ['.directory', '.dir2', '.htaccess']
To see it work locally, you need to stop the server and start it again so that the configuration is loaded (in case you are using jekyll serve
at that time).
Once you include the directory name in the include
variable, it will include that folder and all files and sub-folders under it. Jekyll build will then copy the entire path into your site.
If you want to verify that it worked, do a bundle exec jekyll build
and go to the _site
directory to see if the path is there.
Once done, you’re ready to upload this to your site.
If you’re using IBM Cloud and Staticfile Buildpack for Jekyll, there are a few more things that you will need to do to “allow the Staticfile build pack to serve up the directory”. [coming soon]