Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom Plugins are Ignored #5265

Closed
jamiefolson opened this issue Aug 21, 2016 · 11 comments
Closed

Custom Plugins are Ignored #5265

jamiefolson opened this issue Aug 21, 2016 · 11 comments
Labels
frozen-due-to-age support This is a question about Jekyll's usage.

Comments

@jamiefolson
Copy link

I am trying to create a custom plugin and cannot get anything to work. I've tried all of the examples, which did nothing and resorted to a simple test tag:

In _plugins/testplugin.rb

module Jekyll
  class TestPlugin < Liquid::Tag
    def render(context)
      "It's Working!"
    end
  end
end

Liquid::Template.register_tag('testplugin', Jekyll::TestPlugin)

I even added this to my config:

plugins_dir: ./_plugins

But I still get an error:

jfolson@Ubuntu-Workstation:~/repos/jamiefolson.github.io.jekyll$ bundle exec jekyll build 
Configuration file: /home/jfolson/repos/jamiefolson.github.io.jekyll/_config.yml
            Source: /home/jfolson/repos/jamiefolson.github.io.jekyll
       Destination: /home/jfolson/repos/jamiefolson.github.io.jekyll/_site
 Incremental build: disabled. Enable with --incremental
      Generating... 
  Liquid Exception: Liquid syntax error (line 3): Unknown tag 'testplugin' in plugin_test.md
jekyll 3.1.6 | Error:  Liquid syntax error (line 3): Unknown tag 'testplugin'

when processing this file:


---
layout: default
title: Plugin Test

---

the quick brown fox jumps over the lazy dog.

Testing plugin output of '_plugins/testplugin.rb': {% testplugin %}
  • [x ] I believe this to be a bug, not a question about using Jekyll.
  • [ x] I Updated to the latest Jekyll (or) if on Github Pages to the latest github-pages

  • [x ] I am on (or have tested on) _Debian/Ubuntu_ GNU/Linux
  • [x ] I was trying to build.
@Crunch09
Copy link
Member

Hi @jamiefolson ,

you're using the github-pages gem and it is always started in safe mode and the plugin_dir is a random string. If you want to use custom tags you need to use the jekyll gem directly. Hope this helps!

@jamiefolson
Copy link
Author

Thanks, I didn't realize I'd need to remove it locally, too.

@errordeveloper
Copy link

I've just tripped over this also! Thanks @Crunch09 👍

@maxfarrior
Copy link

I've been trying to solve this problem for 3 days now. I could not figure out why my plugin would not run. I made sure all the software was installed, my _config.yml was good, all the directories existed, and even looked over the ruby plugin itself... Everything looked fine.

Then I found this post and changed 'github-pages' to 'jekyll' in my Gemfile and it worked. Great thanks to @Crunch09.

I knew that I couldn't use the plugin with Github Pages (from trying to figure out the problem), but I wasn't using Github Pages, I was building locally. This was the only info that I found that said to check my Gemfile.

@pathawks
Copy link
Member

@maxfarrior Why were you using github-pages in your Gemfile to begin with? Was there something in our documentation?

Unless a user has a specific reason, we should be instructing them to use jekyll directly rather than github-pages I think.

@maxfarrior
Copy link

@pathawks I was using github-pages because I was modifying (somebody else's) theme that was intended to be hosted at Github Pages. I have no idea if they should be using github-pages or jekyll. But I didn't understand the difference, which caused the problem.

I misled myself. It was not the documentation.

@benbalter
Copy link
Contributor

It sounds like the best solution here would be to post warning level feedback to the build output when a plugin is requested but ignored?

@errordeveloper
Copy link

errordeveloper commented Sep 5, 2017 via email

@thatkookooguy
Copy link

I'm having problems with this. Can someone point me to what I need to change in my _config.yml? where do I change gh-pages to jekyll?

@paradite
Copy link

paradite commented Nov 2, 2018

For anyone experiencing this issue with github-pages gem:

I was trying to update github-pages gem to address a security vulnerability with jekyll, and bumped into this issue, it was working fine on github-pages version 50.

After some digging, I found that somewhere between version 60-75, the plugins starts to get ignored. I am not able to dig into it because the build was failing until I reached version 75.

I am surprised that a external gem can influence how jekyll works. I would expect bundle exec jekyll serve to work as documented: https://jekyllrb.com/docs/plugins/installation/. However, it seems that having an extra dependency breaks the behaviour even on local. Not sure why that happens.

@paradite
Copy link

paradite commented Nov 2, 2018

I'm having problems with this. Can someone point me to what I need to change in my _config.yml? where do I change gh-pages to jekyll?

Just replace
gem 'github-pages', group: :jekyll_plugins
with
gem 'jekyll', group: :jekyll_plugins
inside Gemfile and run bundle install should be enough.

@DirtyF DirtyF added the support This is a question about Jekyll's usage. label Nov 2, 2018
@jekyll jekyll locked and limited conversation to collaborators Nov 2, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
frozen-due-to-age support This is a question about Jekyll's usage.
Projects
None yet
Development

No branches or pull requests

10 participants