Skip to content

xmlb template plugin to generate XML with Wintersmith static site generator

Notifications You must be signed in to change notification settings

stantont/wintersmith-xmlb

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

xmlb template plugin to generate XML with Wintersmith static site generator

Resources

Stars

Watchers

Forks

Packages

No packages published