wintersmith-xmlb

0.0.2 • Public • Published

wintersmith-xmlb

A template plugin for the Wintersmith static site generator that lets one to write xmlb templates to generate XML.

The xmlb template library uses the xmlbuilder-js library to generate XML.

My need for outputting XML was to generate a sitemap file. It could also be used to generate RSS and Atom feeds.

Here's an example of a snippet of a sitemap.xmlb template:

//set up pages array

var root = xml.begin('urlset', {version: '1.0', encoding: 'UTF-8'})
              .att('xmlns', 'http://www.sitemaps.org/schemas/sitemap/0.9')

pages.forEach(function(item){
  root.ele('url')
        .ele('loc')
          .text(locals.url + item.url)
        .up()
        .ele('changefreq')
          .text('weekly')
});

Referenced projects

A special thanks to the wintersmith-ejs project by Stephen Allred, which I used as the template for this project.

Readme

Keywords

none

Package Sidebar

Install

npm i wintersmith-xmlb

Weekly Downloads

0

Version

0.0.2

License

BSD

Last publish

Collaborators

  • stantont