Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to call the `handleize` Liquid filter from Jekyll plugin?

I must be off my game today because I can't even see where the handleize filter is even defined. It's in the Shopify documentation, and it works when I use it in my templates. However I can't see the source code for it, so I can't find out how to call it from my plugin.

Also note that while these two questions are similar, the answers do not apply here because handleize is not defined in either of the source modules mentioned.

If it matters, I'm using Jekyll 2.1.1 and Liquid 2.6.1.

like image 317
Alastair Avatar asked Dec 20 '22 13:12

Alastair


2 Answers

For anyone else who stumbles across this, from Jekyll version 2.4.0 onward, you can use the built-in slugify filter, which basically does what handleize does.

like image 114
M12 Avatar answered May 17 '23 08:05

M12


OK turns out that the Shopify documentation is not correct; some of the documented filters, including handleize are not available from within a standard Jekyll install. The Jekyll core team is aware of the documentation issues and is working towards fixing them.

Also note that liquid does not seem to flag any errors or warnings when using an unknown filter. Hence you may (as I did) think that the filter "works" when in fact it is silently being ignored.

like image 29
Alastair Avatar answered May 17 '23 09:05

Alastair