Create aliases for your posts as nginx configuration for managing the redirection.
Switch branches/tags
Nothing to show
Clone or download
Pull request Compare This branch is 3 commits ahead of drager:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


Create aliases for your posts compiled into a file called nginx.conf in the root of your metalsmith installation.

This file can be imported into an Nginx server directive and will emit a 301 http status for the requests.

This plugin is based on metalsmith-aliases which takes a different approach of creating html files with meta-refresh, but that is W3C depreciated behavior and results in files being downloaded twice, which can make the site appear to be slower.

If you are currently using metalsmith-aliases you can use this as a drop-in replacement. There is no need to run both.


npm install --save metalsmith-aliases-nginx


This plugin depends on having an property called permalink, so in order for it to work we need to either add that ourselves or use the permalinks plugin. This needs to happen before the alias plugin.

Javascript API

var Metalsmith = require('metalsmith');
var aliases = require('metalsmith-aliases-nginx');
var permalinks = require('metalsmith-permalinks');



Add your aliases in the form of an array in your posts:

title: Reactive extensions in Javascript
aliases: [2016/01/14/reactive-extensions-in-javascript]
title: Metalsmith aliases
aliases: [2016/03/15/metalsmith-aliases, metalsmith-using-aliases]


After you run make build you will want to include the nginx.conf file that is generated into your server configuration.