Config Error with Gem Theme

If I understand correctly, since v4, gem based themes should build with the theme’s config data. I am unable to get this working.

For example, collections defined in the theme aren’t being recognized when the gem is used. If I add the collections into the child’s _config.yml they build as expected.

Is there a setting I’m overlooking for the gem to use the parent’s config data?

I did a test with @mmistakes’s minimal-mistakes theme. It is also not inheriting site config data as I had expected.

Have I misunderstood how this works?

I’ve tried using @ashmaroli’s jekyll-data plugin but that’s not working for me either.

Reading the Pre-configuring Theme-gems section of the docs leads me to believe it is possible. What am I doing wrong?

What is the theme that you’re using?
When you say that you tested with minimal-mistakes theme, did you use the gem-version or the remote-repostory? If it is the gem-version, do note that the gem doesn’t bundle the config file.

I’m building my own theme …or trying to anyway.

When I did a test of the minimal-mistakes theme, I ran jekyll new minimal-mistakes-test, then deleted everything in the config file and added theme: minimal-mistakes-jekyll. What I expected was it would pickup the layout defaults and other things from the config file in the theme. It did not.

In the the minimal-mistakes theme and in my own, both configs are being called during build. Here is an example output:

$ bundle exec jekyll build
Configuration file: /themes/phantom-child/_config.yml
 Theme Config file: /themes/phantom/_config.yml
            Source: /themes/phantom-child
       Destination: /themes/phantom-child/_site
 Incremental build: disabled. Enable with --incremental
       Jekyll Feed: Generating feed for posts
         AutoPages: Generating tags pages
         AutoPages: Generating categories pages
         AutoPages: Generating collections pages
        Pagination: Complete, processed 1 pagination page(s)
  Liquid Exception: Liquid error (line 7): Cannot sort a null object. in index.html
      Jekyll 4.1.0   Please append `--trace` to the `build` command 
                     for any additional information or backtrace. 

The “cannot sort a null object” error above is a for loop of a collection. That collection is defined in the theme’s _config.yml.

Okay, there are many roadblocks here.

  • As a security feature, Jekyll 4 doesn’t allow theme config to alter keys of the default configuration. Ergo, top-level keys seen in the documentation can only be overridden by the user’s config file.
  • Jekyll Core’s merge utility only merges keys that were previously undefined, or point to null values.
  • The jekyll-data plugin uses the same merge utility function and moreover has its version of theme-config-import feature disabled when used with Jekyll 4 to avoid conflicts.

The theme-config-import was introduced to allow a theme to be designed and used with its own config keys (e.g. {{ }} , etc) that could then optionally be overridden by the end-user.

The default Liquid filter is an alternative but having a config file meant DRY templates, easier to develop with an array / hash data and that the user need not manually define the variable in their config unless it needed overriding.

If I understand you correctly, by adding the below to the parent-theme’s config, it should then include the portfolio collection in the child-theme without having to redefine it in the child-theme’s config, right?

    output: true

Not exactly.
You can’t use a theme-config to define collections for the theme-user.

Is there documentation about what can be defined? I can’t find anything digging around the docs.

There is no particular documentation about what can be defined but the general doc on the feature is at

Regarding your query, the answer is that you can use any key that is not a top-level key in Jekyll’s default configuration.
(which is documented at:

That’s the list I was looking for. I think I might have seen this before but didn’t know what I was looking at. Thanks for the help @ashmaroli.