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.
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') }}
$ npm install metalsmith-mtime
var mtime = require('metalsmith-mtime');
metalsmith.use(mtime()));
Add the metalsmith-mtime
key to your metalsmith.json
plugins:
{
"plugins": {
"metalsmith-mtime": true
}
}
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.