metalsmith / permalinks

A Metalsmith plugin for permalinks.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Conflict with metalsmith-changed

oscarotero opened this issue · comments

From this issue arve0/metalsmith-changed#11

I've created a function to debug this:

function log () {
  return function (files, metalsmith, done) {
    console.log(Object.keys(files));
    done();
  };
}

In the following config (runned with gulp):

metalsmith(paths.root)
    .metadata(config.metadata || {})
    .source(path.join(paths.src, paths.data))
    .destination(paths.build)
    .clean(false)
    .use(changed())
    .use(markdown())
    .use(log()) //files before
    .use(permalinks())
    .use(log()) //files after
    .build(function(err, files) {
      if (err) {
        console.error(err);
      }
  });
};

The files before execute permalinks are:

[ 'metalsmith-changed-ctimes.json',
  'en.html',
  'es.html',
  'gl.html',
  'index.html',
  'll/en.html' ]

And after:

[ 'metalsmith-changed-ctimes.json',
  'en/index.html',
  'es/index.html',
  'index.html',
  'gl/index.html',
  'll/en/index.html',
  'en/metalsmith-changed-ctimes.json',
  'es/metalsmith-changed-ctimes.json',
  'gl/metalsmith-changed-ctimes.json' ]

So the metalsmith-changed-ctimes.json file is duplicated in each subdirectory.

Ok, I fixed it with the option relative: false.