Merge pull request #1899 from soimort/preview-404
This commit is contained in:
commit
a33e86630d
|
@ -10,6 +10,15 @@ module Jekyll
|
||||||
|
|
||||||
FileUtils.mkdir_p(destination)
|
FileUtils.mkdir_p(destination)
|
||||||
|
|
||||||
|
# monkey patch WEBrick using custom 404 page (/404.html)
|
||||||
|
if File.exists?(File.join(destination, '404.html'))
|
||||||
|
WEBrick::HTTPResponse.class_eval do
|
||||||
|
def create_error_page
|
||||||
|
@body = IO.read(File.join(@config[:DocumentRoot], '404.html'))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
# recreate NondisclosureName under utf-8 circumstance
|
# recreate NondisclosureName under utf-8 circumstance
|
||||||
fh_option = WEBrick::Config::FileHandler
|
fh_option = WEBrick::Config::FileHandler
|
||||||
fh_option[:NondisclosureName] = ['.ht*','~*']
|
fh_option[:NondisclosureName] = ['.ht*','~*']
|
||||||
|
@ -33,6 +42,7 @@ module Jekyll
|
||||||
|
|
||||||
def self.webrick_options(config)
|
def self.webrick_options(config)
|
||||||
opts = {
|
opts = {
|
||||||
|
:DocumentRoot => config['destination'],
|
||||||
:Port => config['port'],
|
:Port => config['port'],
|
||||||
:BindAddress => config['host'],
|
:BindAddress => config['host'],
|
||||||
:MimeTypes => self.mime_types,
|
:MimeTypes => self.mime_types,
|
||||||
|
|
Loading…
Reference in New Issue