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

Allow projects to have their own Liquid tags #19

Closed
n8agrin opened this Issue Apr 26, 2009 · 22 comments

Comments

Projects
None yet
@n8agrin

n8agrin commented Apr 26, 2009

I find that I often need to implement my own Liquid tags for various projects I've worked on in Jekyll. I implemented this in my Jekyll branch by allowing each project to have its own _tags directory. Here's the patch; happy to refactor if you like the idea but not the implementation:

http://github.com/n8agrin/jekyll/commit/f65e50703ce2671f532e7bbdecfebf11aeccf9ad

@qrush

This comment has been minimized.

Contributor

qrush commented Apr 26, 2009

I like it. This definitely needs some tests and features built in if you want it included.

@n8agrin

This comment has been minimized.

n8agrin commented Apr 26, 2009

I'll gladly write the tests. Can you elaborate on what you mean by "features built in" so I can move forward on getting this integrated?

Sorry about the dup msg...

@qrush

This comment has been minimized.

Contributor

qrush commented Apr 26, 2009

No problem. I meant a Cucumber feature/integration test for this, just to ensure that it works as expected.

@qrush

This comment has been minimized.

Contributor

qrush commented May 3, 2009

Another issue with this: some sort of secure: false flag should be necessary to enable this feature. Since Jekyll is in charge of generating the GitHub pages, we can't let just anyone to execute whatever they'd like on the server. For most users generating posts though, this behavior is extremely useful.

@n8agrin

This comment has been minimized.

n8agrin commented May 10, 2009

That shouldn't be hard to implement. I'll add it in my fork.

@n8agrin

This comment has been minimized.

n8agrin commented May 14, 2009

I added support for a _liquid_tags directory along with a config param "liquid_tags" that defaults to false. Also added two tests to test_site. It may be worth breaking the "should load external tags" test into its own context since it uses its own site with a different config. Let me know what you think.

http://github.com/n8agrin/jekyll/commit/dfd5ef02b4c0edf59476aa15b472a0a5ab9980ee

@n8agrin

This comment has been minimized.

n8agrin commented Jun 1, 2009

I see this is on hold. Anything else I can do to help it get through?

@qrush

This comment has been minimized.

Contributor

qrush commented Jun 1, 2009

There's been no work done towards an insecure/secure mode yet. I'd like to see that in the lib first. The same conditions apply as my earlier comment.

@n8agrin

This comment has been minimized.

n8agrin commented Jun 1, 2009

Ah ok, I didn't interpret your earlier request as you literally wanted a "secure: false" flag implemented. I took that to mean you wanted the option to turn importing custom tags on and off, hence the liquid_tags config param. My mistake, shouldn't be hard to get a secure flag working.

@bentomas

This comment has been minimized.

bentomas commented Oct 14, 2009

What's holding this back? It seems like it has a command line flag to turn it on or off. why isn't that enough?

@bentomas

This comment has been minimized.

bentomas commented Oct 21, 2009

While I realize people are working on this (sorry to be impatient!), I have come up with a temporary solution for those that are interested:

http://benjaminthomas.org/2009/10/21/custom-liquid-tags-in-jekyll.html

@n8agrin

This comment has been minimized.

n8agrin commented Oct 22, 2009

Cool. I just bumped this here: http://github.com/n8agrin/jekyll/commit/4b82e06f8b0ee153149edc803abd297d50539b41 Hopefully that's should cover everything.

@n8agrin

This comment has been minimized.

n8agrin commented Oct 22, 2009

Summary of changes:

  1. Changed liquid_tags flag to "secure", secure is set to true by default
  2. Added if block that checks the secure flag, if it's false, liquid tags (and presumably other insecure code) can be loaded.
  3. Added tests for the liquid tags.

I'm not terribly happy with the line that reads "load file unless require file", I may change that to just "load file".

Please review and let me know if there are issues which need to be resolved before this can be merged.

@jodosha

This comment has been minimized.

@knuton

This comment has been minimized.

knuton commented Dec 14, 2009

Are there any issues left that need to be tackled?

@n8agrin

This comment has been minimized.

n8agrin commented Dec 14, 2009

None that I know of. We have 3 implementations, each of which seem fine. Unclear to me what's holding this oft-requested feature up.

@yob

This comment has been minimized.

yob commented Dec 23, 2009

+1 to this feature, it'd be really nice to have the option to extend jekyll sites without forking and building my own gem.

@krisb

This comment has been minimized.

Contributor

krisb commented Jan 6, 2010

#100 addresses this nicely too in a generic extensions way as requested by qrush.

@rfelix

This comment has been minimized.

rfelix commented Jan 19, 2010

I've come up with another solution (http://github.com/rfelix/jekyll_ext) that not only allows you to easily add liquid tags for your blog, but also allows you to extend Jekyll without forking and modifying the gem's codebase.

The extensions live under the "_extensions" directory of your blog, and this is how easy it is to add custom liquid tags: http://github.com/rfelix/my_jekyll_extensions/blob/master/my_filters/my_filters.rb

Read my post about it for more information: http://rfelix.com/2010/01/19/jekyll-extensions-minus-equal-pain/

@mojombo

This comment has been minimized.

Contributor

mojombo commented Jun 19, 2010

The latest on master now has Plugin support. Look at lib/jekyll/converters for examples of how they're done. Also, any *.rb files in a _plugins directory will be loaded so that you can create custom plugins of your own.

@kikito

This comment has been minimized.

kikito commented Jun 22, 2010

I've readed the source code but can't figure out how the plugins are supposed to work. I'd appreciate some orientation on that respect (maybe updating of the "hacking jekyll" wiki page)

@kikito

This comment has been minimized.

kikito commented Jun 25, 2010

I see that the new page is created ( http://wiki.github.com/mojombo/jekyll/plugins ). Thanks!

@jekyll jekyll locked and limited conversation to collaborators Feb 27, 2017

This issue was closed.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.