fix: load site config broke in group plugins (#12)

This commit is contained in:
jeffreytse 2020-06-22 12:16:02 +08:00
parent b3b7d1fb15
commit a30d7e46f0
2 changed files with 7 additions and 4 deletions

View File

@ -8,5 +8,5 @@ require 'jekyll-spaceship/cores/register'
module Jekyll::Spaceship module Jekyll::Spaceship
Logger.display_info Logger.display_info
Config.load Config.load_config
end end

View File

@ -35,7 +35,7 @@ module Jekyll::Spaceship
@@store[section] = deep_merge(default, @@store[section]) @@store[section] = deep_merge(default, @@store[section])
end end
def self.load(config = self.site_config) def self.load(config = {})
config = deep_merge( config = deep_merge(
{ CONFIG_NAME => DEFAULT_CONFIG }, { CONFIG_NAME => DEFAULT_CONFIG },
config config
@ -50,8 +50,11 @@ module Jekyll::Spaceship
end end
end end
def self.site_config def self.load_config
Jekyll.sites.first.config # post load site config for `group :jekyll_plugin`
Jekyll::Hooks.register :site, :after_init do |site|
self.load(site.config)
end
end end
end end
end end