Skip to content

Instantly share code, notes, and snippets.

@growdigital
Created June 2, 2017 11:45
Show Gist options
  • Save growdigital/cd24b00d1c8150af8baa9000d534ac36 to your computer and use it in GitHub Desktop.
Save growdigital/cd24b00d1c8150af8baa9000d534ac36 to your computer and use it in GitHub Desktop.
index.js of static-site test for metalsmith-rewrite
var Metalsmith = require('metalsmith');
var markdown = require('metalsmith-markdown');
var layouts = require('metalsmith-layouts');
var permalinks = require('metalsmith-permalinks');
var rewrite = require('metalsmith-rewrite');
Metalsmith(__dirname)
.metadata({
title: "My Static Site & Blog",
description: "It's about saying »Hello« to the World.",
generator: "Metalsmith",
url: "http://www.metalsmith.io/"
})
.source('./src')
.destination('./build')
.clean(false)
.use(markdown())
.use(rewrite({
pattern: 'blog/**/*.html',
filename: 'blog/{date}/build.html',
date: 'YYYY/MM'
}))
.use(permalinks())
.use(layouts({
engine: 'handlebars'
}))
.build(function(err, files) {
if (err) { throw err; }
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment