Eleventy: Add Jekyll extended filters to Liquid

Created on 30 May 2019  路  7Comments  路  Source: 11ty/eleventy

Hi there! I recently moved from Jekyll to Eleventy (and loved it), and I would like to give back some in the form of contributions. I found that on my migration (of a pretty much standard GitHub Pages project using Jekyll) I really missed a couple of filters that aren't part of Liquid, but Jekyll extends for users.

  • {{ post.time | date_to_rfc822 }}, this filter is super useful because it returns date in the exact format expected by RSS validators and readers.
  • {{ post.time | date_to_xmlschema }}, returns date into the expected format for xml sitemap files.
  • {{ post.data.title | xml_escape }}, escapes text for xml use.
  • {{ post.data.excerpt | markdownify }}, really useful to render frontmatter data as markdown,

If it's from the project's author and collaborators interest in adding these I can start working on it, but first I want to ask in case it's not in the project scope to cover this :)

Thanks 鉂わ笍

education

Most helpful comment

Hey @jeremenichelli I would love to see the first three listed there exposed as an Eleventy plugin that we could link up from the docs? Something like eleventy-jekyll-filters? https://www.11ty.io/docs/plugins/

I could even envision it as part of https://github.com/11ty/eleventy-plugin-rss There may be some overlap there already (but things aren鈥檛 named the same).

The markdownify filter (or similar) is slated as part of https://github.com/11ty/eleventy/issues/148

Does this answer your question?

All 7 comments

Hi @jeremenichelli,
glad you like eleventy as much as we do :-)
Could you add your comment to #394?

Hmm I saw that issues but is about plugins, not filters that Jekyll extends. I'm gonna leave a brief comment cause I don't want to pollute the conversation there.

Hey @jeremenichelli I would love to see the first three listed there exposed as an Eleventy plugin that we could link up from the docs? Something like eleventy-jekyll-filters? https://www.11ty.io/docs/plugins/

I could even envision it as part of https://github.com/11ty/eleventy-plugin-rss There may be some overlap there already (but things aren鈥檛 named the same).

The markdownify filter (or similar) is slated as part of https://github.com/11ty/eleventy/issues/148

Does this answer your question?

Hi Zach! Yes, this could work, if you think this filters better belong to that plugin I'm gonna work there then. I'll keep you posted. Thanks!

@zachleat I say eleventy-rss-plugin and noticed it adds Nunjucks filters, while I was interested in adding Liquid ones. I didn't wanted to bloat the plugin with doing a lot of different stuff for different tempalte engines, so I created my own Eleventy plugin :)

馃憠 https://github.com/jeremenichelli/eleventy-xml-plugin

It adds the three filters we've been talking about, I tested the output with RSS and sitemap validators and they pass, of course it's the first version of the package so feedback is more than welcome.

If at some point you think it would be good for those filters to be part of the core package or any other package of the family let me know, more than welcome to collaborate.

@jeremenichelli Mind adding a link to https://github.com/11ty/11ty.io/blob/master/docs/plugins.md ?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

michrome picture michrome  路  3Comments

zac-heisey picture zac-heisey  路  3Comments

zellwk picture zellwk  路  3Comments

robdodson picture robdodson  路  3Comments

kaloja picture kaloja  路  3Comments