metalsmith-mtime v0.0.3
DEPRECATED
This plugin is deprecated, its functionality is now fully integrated into Metalsmith core.
Since version
0.10.0
Metalsmith adds full file
stats to metadata.
If you're using metalsmith-mtime with 0.10, or newer, version of Metalsmith,
replace mtime, in your code, with stats.mtime and remove
"metalsmith-mtime" from dependencies.
metalsmith-mtime
A Metalsmith plugin that adds files last modification times to their Metalsmith metadata.
This plugin iterates over Metalsmith files and adds mtime property to
metadata of each entry in files that corresponds to file existing in
filesystem. Value of this property is an instance of Date representing files
last modification time.
mtime property can be used e.g. in a template
(here we use swig):
Last modified: {{ mtime|date('Y.m.d H:i') }}Installation
$ npm install metalsmith-mtimeUsage
JavaScript
var mtime = require('metalsmith-mtime');
metalsmith.use(mtime()));CLI
Add the metalsmith-mtime key to your metalsmith.json plugins:
{
"plugins": {
"metalsmith-mtime": true
}
}Tips
If you keep source code of your website in Git, be aware that Git does not store file mtimes. So to use this plugin you would also need one of additional tools for handling metadata in Git.