Assemble plugin for easily creating permalinks (Assemble ^0.6.0)
(TOC generated by verb using markdown-toc)
Install with npm:
$ npm i assemble-permalinks --save
var permalinks = require('assemble-permalinks');
var assemble = require('assemble');
var app = assemble();
// register the plugin, optionally passing a
// default permalink pattern to use as an argument
// to the plugin
app.use(permalinks());
Example usage
// create a view collection
app.create('pages');
// add a page
app.page('a/b/c.txt', {content: '...'})
.permalink(':name.html');
var page = app.pages.getView('a/b/c.txt');
console.log(page.data.permalink);
//=> 'c.html'
Pipeline plugin
var posts = app.create('posts')
.use(permalink('actual/:name/index.html'));
app.task('site', function() {
return posts.src('*.js')
.pipe(posts.permalink())
.pipe(posts.dest('.'));
});
app.build('site', function(err) {
if (err) throw err;
console.log('done!');
});
- assemble: Assemble is a powerful, extendable and easy to use static site generator for node.js. Used… more | homepage
- templates: System for creating and managing template collections, and rendering templates with any node.js template engine.… more | homepage
Install dev dependencies:
$ npm i -d && npm test
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.
Jon Schlinkert
Copyright © 2016 Jon Schlinkert Released under the MIT license.
This file was generated by verb on January 15, 2016.