Add Hook for :site :after_init
This commit is contained in:
parent
b5e459430b
commit
84b7d9b3ac
|
@ -12,6 +12,7 @@ module Jekyll
|
||||||
# initial empty hooks
|
# initial empty hooks
|
||||||
@registry = {
|
@registry = {
|
||||||
:site => {
|
:site => {
|
||||||
|
:after_init => [],
|
||||||
:after_reset => [],
|
:after_reset => [],
|
||||||
:post_read => [],
|
:post_read => [],
|
||||||
:pre_render => [],
|
:pre_render => [],
|
||||||
|
|
|
@ -17,6 +17,8 @@ module Jekyll
|
||||||
#
|
#
|
||||||
# config - A Hash containing site configuration details.
|
# config - A Hash containing site configuration details.
|
||||||
def initialize(config)
|
def initialize(config)
|
||||||
|
|
||||||
|
Jekyll::Hooks.trigger :site, :after_init, self
|
||||||
@config = config.clone
|
@config = config.clone
|
||||||
|
|
||||||
%w(safe lsi highlighter baseurl exclude include future unpublished
|
%w(safe lsi highlighter baseurl exclude include future unpublished
|
||||||
|
@ -24,17 +26,6 @@ module Jekyll
|
||||||
self.send("#{opt}=", config[opt])
|
self.send("#{opt}=", config[opt])
|
||||||
end
|
end
|
||||||
|
|
||||||
# Source and destination may not be changed after the site has been created.
|
|
||||||
@source = File.expand_path(config['source']).freeze
|
|
||||||
@dest = File.expand_path(config['destination']).freeze
|
|
||||||
|
|
||||||
@reader = Jekyll::Reader.new(self)
|
|
||||||
|
|
||||||
# Initialize incremental regenerator
|
|
||||||
@regenerator = Regenerator.new(self)
|
|
||||||
|
|
||||||
@liquid_renderer = LiquidRenderer.new(self)
|
|
||||||
|
|
||||||
self.plugin_manager = Jekyll::PluginManager.new(self)
|
self.plugin_manager = Jekyll::PluginManager.new(self)
|
||||||
self.plugins = plugin_manager.plugins_path
|
self.plugins = plugin_manager.plugins_path
|
||||||
|
|
||||||
|
@ -43,10 +34,7 @@ module Jekyll
|
||||||
|
|
||||||
self.permalink_style = config['permalink'].to_sym
|
self.permalink_style = config['permalink'].to_sym
|
||||||
|
|
||||||
Jekyll.sites << self
|
@config
|
||||||
|
|
||||||
reset
|
|
||||||
setup
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# Public: Read, process, and write this Site to output.
|
# Public: Read, process, and write this Site to output.
|
||||||
|
|
|
@ -516,6 +516,18 @@ The complete list of available hooks is below:
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<p><code>:site</code></p>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<p><code>:after_init</code></p>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<p>Just after the site initializes, but before setup & render. Good
|
||||||
|
for modifying the configuration of the site.</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<p><code>:site</code></p>
|
<p><code>:site</code></p>
|
||||||
|
|
Loading…
Reference in New Issue