代码之家  ›  专栏  ›  技术社区  ›  jessi

如何为jekyll使用本地插件?

  •  1
  • jessi  · 技术社区  · 6 年前

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

    一切都很好。

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

    根据我在这里读到的和杰基尔。rb站点,问题可能是我有 github-pages 我的Gemfile中的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 回复  |  直到 6 年前
        1
  •  1
  •   ashmaroli    6 年前

    您收到该错误是因为您没有添加 pygments.rb 到您的 Gemfile 只需将其添加到 Gemfile公司 这个错误应该会消失。

    # Gemfile
    
    gem 'jekyll'
    gem 'pygments.rb'
    
    group :jekyll_plugins do
      gem 'jekyll-paginate'
      gem 'jekyll-scholar'
      gem 'jemoji'
    end