使用github和jekyll打造自己的独立博客及常见问题

来源:互联网 发布:江西先锋软件技术学院 编辑:程序博客网 时间:2024/06/05 10:47

使用github和jekyll打造自己的独立博客

利用Github提供的Pages功能,把本地搭建的Jekyll站点部署上去,实现一个自由定制的个人静态博客。具体的操作google教程一大把,这里就不再重复造车,本文主要记录自己在这2天参考的教程,以及在操作过程中遇到的各种疑难杂症,供有需要的朋友少走弯路。
参考文章:
  • 《阮一峰的搭建一个免费的,无限流量的Blog----github Pages和Jekyll入门》
  • 《使用 GitHub, Jekyll 打造自己的免费独立博客》
  • 《Jekyll和Github搭建个人静态博客》
仔细看看上面三篇文章,基本能打造一个自己的独立blog,过程中有疑问请自行google,下面主要记录自己搭建时遇到的几个奇葩问题。

github和jekyll打造个人博客常见问题

gem安装jekyll报错Could not find a valid gem 'jekyll'

报错:ERROR:Could not find a valid gem 'jekyll' (>= 0), here is why:      Unable to download data from https://rubygems.org/ - no such name (https://api.rubygems.org/specs.4.8.gz)
解决方法:
参考https://gems.ruby-china.org/,将gem源修改成http://gems.ruby-china.org 修改成功后查看源信息如下图


jekyll新建博客报错找不到系统路径

jekyll新建blog报错Runing bundle install in ...系统找不到指定路径
同时启动server时报错
D:\blog>jekyll serveC:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.11.2/lib/bundler/resolver.rb:354:in `block in verify_gemfile_dependencies_are_found!': Could not find gem 'minima (~> 2.0) x86-mingw32' in any of the gem sources listed in your Gemfile or available on this machine. (Bundler::GemNotFound)        from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.11.2/lib/bundler/resolver.rb:330:in `each'        from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.11.2/lib/bundler/resolver.rb:330:in `verify_gemfile_dependencies_are_found!'        from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.11.2/lib/bundler/resolver.rb:199:in `start'        from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.11.2/lib/bundler/resolver.rb:183:in `resolve'        from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.11.2/lib/bundler/definition.rb:198:in `resolve'        from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.11.2/lib/bundler/definition.rb:137:in `specs'        from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.11.2/lib/bundler/definition.rb:182:in `specs_for'        from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.11.2/lib/bundler/definition.rb:171:in `requested_specs'        from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.11.2/lib/bundler/environment.rb:18:in `requested_specs'        from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:13:in `setup'        from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.11.2/lib/bundler.rb:92:in `setup'        from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/jekyll-3.3.0/lib/jekyll/plugin_manager.rb:36:in `require_from_bundler'        from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/jekyll-3.3.0/exe/jekyll:9:in `<top (required)>'        from C:/RailsInstaller/Ruby2.2.0/bin/jekyll:23:in `load'        from C:/RailsInstaller/Ruby2.2.0/bin/jekyll:23:in `<main>'
解决方法:
gem安装bundler(注意翻越万里长城)


jekyll启动server时候报错haven't included the 'jekyll-paginate'

报错:Deprecation: You appear to have pagination turned on, but you haven't included the `jekyll-paginate` gem. Ensure you have `gems: [jekyll-paginate]` in your configuration file.
解决方法:
gem安装jekyll-paginate如下图

注意安装成功后在_config.yml里面添加gems: [jekyll-paginate]配置属性

如果使用duoshuo评论插件,去掉多说评论框右下角的版权声明powered by方法如下

登录多说后台管理,在设置里面找到自定义CSS,贴上下面这句代码:

#ds-thread .ds-powered-by{display:none!important;}






0 0