如何使用jekyll的本地插件?

时间:2018-04-07 23:33:28

标签: jekyll

我的jekyll网站托管在服务器上,我只需上传_site文件夹。

一切都很好。

但是,我想添加本地插件。当我将文件添加到 new _plugins文件夹时,它们会被忽略,我的新声明标签会出现Liquid syntax error (line 7): Unknown tag ...错误。

基于我在这里和jekyll.rb网站上看到的内容,问题可能是我的Gemfile中有一个github-pages gem。

的Gemfile

source 'https://rubygems.org'
group :jekyll_plugins do
    gem 'github-pages'
    gem 'jekyll'
    gem 'jekyll-paginate'
    gem 'jekyll-scholar'
    gem 'jemoji'
end

但是,如果我删除gem 'github-pages'行,我最终会遇到此错误:

 Dependency Error: Yikes! It looks like you don't have pygments or one of its dependencies installed. In order to use Jekyll as currently configured, you'll need to install this gem. The full error message from Ruby is: 'cannot load such file -- pygments' If you run into trouble, you can find helpful resources at https://jekyllrb.com/help/! 

如果我安装pygments,我仍然会收到相同的错误,但安装似乎成功

$ gem install pygments.rb          [8:05:33]
Fetching: pygments.rb-1.2.1.gem (100%)
Successfully installed pygments.rb-1.2.1
Parsing documentation for pygments.rb-1.2.1
Installing ri documentation for pygments.rb-1.2.1
Done installing documentation for pygments.rb after 0 seconds
1 gem installed

我可以做些什么才能使我的本地插件可用? (我真的只是希望能够嵌入本地视频,所以我添加了一个插件)

1 个答案:

答案 0 :(得分:0)

您收到该错误是因为您尚未向pygments.rb添加Gemfile 只需将其添加到Gemfile,此错误就会消失。

# Gemfile

gem 'jekyll'
gem 'pygments.rb'

group :jekyll_plugins do
  gem 'jekyll-paginate'
  gem 'jekyll-scholar'
  gem 'jemoji'
end