Jekyll server本地预览文章not found
解决方案:
找到文件C:\Ruby26-x64\lib\ruby\2.6.0\webrick\httpservlet\filehandler.rb,具体安装目录根据实际情况确定;
文件修改如下所示;
diff --git a/filehandler_back.rb b/filehandler.rb
index 601882e..10f51d6 100644
--- a/filehandler_back.rb
+++ b/filehandler.rb
@@ -283,6 +283,7 @@ module WEBrick
# dirty hack for filesystem encoding; in nature, File.expand_path
# should not be used for path normalization. [Bug #3345]
path = req.path_info.dup.force_encoding(Encoding.find("filesystem"))
+ path.force_encoding("UTF-8")
if trailing_pathsep?(req.path_info)
# File.expand_path removes the trailing path separator.
# Adding a character is a workaround to save it.
@@ -330,6 +331,7 @@ module WEBrick
path_info.unshift("") # dummy for checking @root dir
while base = path_info.first
break if base == "/"
+ base.force_encoding("UTF-8")
break unless File.directory?(File.expand_path(res.filename + base))
shift_path_info(req, res, path_info)
call_callback(:DirectoryCallback, req, res)
主要是添加两处UTF-8
使用jekyll server的同学需要这样:
gem update jekyll # 更新jekyll
gem update github-pages #更新依赖的包
使用bundle exec jekyll server的同学在更新 jekyll 后,需要输入bundle update来更新依赖的包.
bundle install
bundle update
bundle exec jekyll server 本地查看
bundle exec jekyll build 提交github
使用Github Pages构造属于自己的博客:如何在本地使用jekyll
原文:https://www.cnblogs.com/ychao661/p/13667723.html