var dateHelpers = require('{%= name %}');
var Permalinks = require('permalinks');
var permalinks = new Permalinks();
permalinks.use(dateHelpers());
var file = {path: 'posts/about.md', data: {date: '2017-02-02'}};
permalinks.format(':year/:month/:day/:stem/index.html');
//=> '2017/02/02/about/index.html'
permalinks.format(':date("YYYY/MM/DD")/:stem/index.html');
//=> '2017/02/02/about/index.html'
{%= apidocs("index.js") %}
In addition to the date helper itself, the following variables will be exposed on the context as a result of registering the date
helper (these aren't helpers, just strings):
Name | Description | Example |
---|---|---|
:year |
Published year of posts (4-digit) | 2017 |
:month |
Published month of posts (2-digit) | 09 |
:i_month |
Published month of posts (Without leading zeros) | 9 |
:day |
Published day of posts (2-digit) | 02 |
:i_day |
Published day of posts (Without leading zeros) | 2 |
:hour |
Hour of the day | 11 |
:minute |
Minute of the hour | 15 |
:second |
Second of the minute | 45 |