metalsmith-untemplatize

May 1, 2014 ยท View on GitHub

A Metalsmith plugin to extract untemplatized file contents.

Use Case

This can be pretty useful when you need to access file contents without any template rendering in other templates (such as RSS/Atom feeds).

Installation

$ npm install --save metalsmith-untemplatize

CLI Usage

{
  "plugins": {
    "metalsmith-untemplatize": {
      "key": "untemplatized"
    }
  }
}

API Usage

var untemplatize = require('metalsmith-untemplatize');
metalmisth.use(untemplatize({
  key: 'untemplatized'
}));

Plugin Order

Be sure to add this plugin before metalsmith-templates and after any rendering content plugin like metalsmith-markdown.

Example:

Metalsmith(__dirname)
  .use(markdown())
  .use(untemplatize())
  .use(templates('handlebars'))
  .build();

Options

key

The key name which stores the untemplatized content. Defaults to untemplatized. Feel free to use your own (example: content, body, banana or anything else).

License

MIT