Search code examples
jekyll

Changing Jekyll's source directory and keeping other directorys there they are


I would like to change Jekyll's source directory but in the same moment I would like to keep the other relevant directorys like _includes at the same place.

To achive this I set source in _config.yml to _source. This works but it seems that all other configuration values like includes_dir are always relative to source.

How can I configure includes_dir and all the other values independently of source?

My desired directory structure looks like this:

+- _source
+- _includes
+- _posts
+- ...
 \ _config.yml

Solution

  • Jekyll expects all directorys below the source directory.

    I found that out by looking into Jekyll's source code. The class Site contains several methods dealing with the configured directorys. All of them use the method in_source_dir to determine the effective path.

    The method configure_include_paths is a good example for this.

    def configure_include_paths
      @includes_load_paths = Array(in_source_dir(config["includes_dir"].to_s))
      @includes_load_paths << theme.includes_path if theme&.includes_path
    end