Created
March 12, 2009 13:03
-
-
Save sixones/78048 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
h3. Custom Filters | |
Jekyll can use custom liquid filters for the rendering of your site, these | |
can be created in the same way as standard liquid filters. Before a filter | |
will work through Jekyll you need to include the filter module: | |
include Jekyll::Filters::Custom | |
Filters are expected inside a <code>_filters</code> directory at the root of | |
your source directory. | |
Jekyll custom liquid filter example: | |
module MyModule | |
module StringFilter | |
include Jekyll::Filters::Custom | |
def my_filter(arg) | |
"Hello World!" | |
end | |
end | |
end | |
You would then be able to use the filter inside your templates: | |
{{ "arg" | my_filter }} | |
Custom filters can be disabled by running Jekyll with the disable flag: | |
$ jekyll --disable-custom-filters |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment