Learn about our RFC process, Open RFC meetings & more.Join in the discussion! »

eleventy-xml-plugin

0.1.0 • Public • Published

eleventy-xml-plugin

Build Status

👩‍🔬 Useful set of Liquid filters for XML files composition in Eleventy projects.

This plugins automatically adds a set of filters that Jekyll adds to the already built-in ones in Liquid template language to help you compose XML files like RSS feeds or sitemaps.

Install

# npm 
npm i eleventy-xml-plugin --save
 
# yarn 
yarn add eleventy-xml-plugin

Add plugin

Include it as a plugin in your Eleventy project.

// .eleventy.js
const xmlFiltersPlugin = require('eleventy-xml-plugin')
 
module.exports = function(eleventyConfig) {
  eleventyConfig.addPlugin(xmlFiltersPlugin)
}

Filters

date_to_rfc822

Used in RSS feed as a valid publish date format.

<pubDate>{{ post.date | 'date_to_rfc822' }}</pubDate>

date_to_xmlschema

Used in sitemaps as valid last modified date format.

<lastmod>{{ page.date | 'date_to_xmlschema' }}</lastmod>

xml_escape

Used to safely escape HTML entities in XML files.

<title>{{ post.data.title | 'xml_escape' }}</title>

This filter uses the html-entities package under-the-hood.

Contributing

To contribute Node.js and yarn are required.

Before commit make sure to follow conventional commits specification and check all tests pass by running yarn test.

Install

npm i eleventy-xml-plugin

DownloadsWeekly Downloads

60

Version

0.1.0

License

MIT

Unpacked Size

492 kB

Total Files

9

Last publish

Collaborators

  • avatar