diff --git a/docs/_docs/configuration/options.md b/docs/_docs/configuration/options.md index 90bfaff1478..d24da86b509 100644 --- a/docs/_docs/configuration/options.md +++ b/docs/_docs/configuration/options.md @@ -72,6 +72,24 @@ class="flag">flags (specified on the command-line) that control them.

--disable-disk-cache

+ + +

+ Ignore theme configuration + 4.1.0 +

+

+ Jekyll 4.0 started allowing themes to bundle a _config.yml + to simplify theme-onboarding for new users. + In the unfortunate situation that importing a bundled theme configuration + messes up the merged site-configuration, the user can configure Jekyll + to not import the theme-config entirely. +

+ + +

ignore_theme_config: BOOL

+ +

Exclude

diff --git a/features/theme_configuration.feature b/features/theme_configuration.feature index 6ddfd4ae662..00ed81ae4cc 100644 --- a/features/theme_configuration.feature +++ b/features/theme_configuration.feature @@ -11,6 +11,17 @@ Feature: Bundling Config file with Theme gems And the _site directory should exist And I should see "aero" in "_site/index.html" + Scenario: Disabling import of theme configuration entirely + Given I have a configuration file with: + | key | value | + | theme | test-theme | + | ignore_theme_config | true | + And I have an "index.md" page that contains "{{ site.test_theme.skin }}" + When I run jekyll build + Then I should get a zero exit status + And the _site directory should exist + And I should not see "aero" in "_site/index.html" + Scenario: A pre-configured theme with valid config file overriding Jekyll defaults Given I have a configuration file with "theme" set to "test-theme" And I have an "index.md" page that contains "{{ site.baseurl }}" diff --git a/lib/jekyll/site.rb b/lib/jekyll/site.rb index 5195a377e1e..da8dce68d3c 100644 --- a/lib/jekyll/site.rb +++ b/lib/jekyll/site.rb @@ -432,6 +432,8 @@ def collections_path private def load_theme_configuration(config) + return config if config["ignore_theme_config"] == true + theme_config_file = in_theme_dir("_config.yml") return config unless File.exist?(theme_config_file)