code: function loadPartials(files, metalsmith, done) {
    var metadata = metalsmith.metadata();
    
    fs.readdirAsync("./partials", "utf8")
      .then(files => {
        var promises = files.map(filename => {
          var m = filename.match(/^(.+)\.([^.]+)$/);
          if (!m)
            return;
          var name = m[1];
          var ext = m[2];
          return fs.readFileAsync("partials/" + filename, "utf8")
            .then(data => {
              var fn;
              try {
                fn = dot.template(data);
              }catch(err) {
                console.log("Failed to load partial " + filename + ": " + err);
                return;
              }
              fn.name = filename;
              metadata.partials[filename] = fn;
              if (ext == "html")
                metadata.partials[name] = fn; 
            });
        });
        return Promise.all(promises);
      })
      .then(() => done())
      .catch(err => done(err));
  }
docs: Metalsmith plugin that loads partials and adding them to the metadata.partials map.  Each file
  is added with it's filename, and if it is a .html filename is also added without the .html
  extension.