Journey to Jekyll: Part 5 - Showing .directories with Staticfile Buildpack

If you’re using IBM Cloud and Staticfile Buildpack for Jekyll and want to show the contents of directories that start with a “.” on your statically generated site, you need to do a couple of things.

In the post about getting Jekyll to include .directories we covered how the local .directory will get pushed to the server. However, the Staticfile Buildpack also rejects showing the contents of files or directories that begin with a “.”

To enable this, you need to do the following:

  1. Add a new file in the root directory of your project (where the _config.yml) is and call it Staticfile – this provides additional configuration options for the Staticfile Buildpack once it is set up and launched.
  2. In that file, add the following line:
    host_dot_files: true

This will tell the web server to show files and directories that start with a . on the website.

If you also want to show the contents of directories if there is no index.html in the directory, you can add another line directory: visible so it looks like this:

host_dot_files: true
directory: visible

If you want to verify that it worked, do a bundle exec jekyll build and go to the _site directory to see if the Staticfile is there.

Once done, you’re ready to upload this to your site.

comments powered by Disqus