index.js
function transformChunkData(chunk) {
    var matter = grayMatter(String(chunk.contents)),
        relPath = chunk.hasOwnProperty('data') && chunk.data.relativePath ?
          chunk.data.relativePath : getRelativePath(chunk.relative),
        absPath = path.normalize(path.join(options.basePath, relPath));
    chunk.data = merge.recursive({},
      options.data,
      {
        basePath: options.basePath,
        relativePath: relPath,
        path: absPath,
        urlPath: options.prettyUrls ? path.dirname(absPath) + '/' : absPath,
        srcBasePath: chunk.base,
        srcRelativePath: chunk.relative,
        srcPath: chunk.path,
        contents: '',
        draft: false,
        layout: options.defaultLayout
      },
      chunk.data || {},
      matter.data
    );
    chunk.contents = new Buffer(matter.content);
    chunk.path = path.join(chunk.base, relPath);
    return chunk;
  }
function transformChunkData(chunk) {
    var matter = grayMatter(String(chunk.contents)),
        relPath = chunk.hasOwnProperty('data') && chunk.data.relativePath ?
          chunk.data.relativePath : getRelativePath(chunk.relative),
        absPath = path.normalize(path.join(options.basePath, relPath));
    chunk.data = merge.recursive({},
      options.data,
      {
        basePath: options.basePath,
        relativePath: relPath,
        path: absPath,
        urlPath: options.prettyUrls ? path.dirname(absPath) + '/' : absPath,
        srcBasePath: chunk.base,
        srcRelativePath: chunk.relative,
        srcPath: chunk.path,
        contents: '',
        draft: false,
        layout: options.defaultLayout
      },
      chunk.data || {},
      matter.data
    );
    chunk.contents = new Buffer(matter.content);
    chunk.path = path.join(chunk.base, relPath);
    return chunk;
  }
function transformChunkData ( chunk ) { var matter = grayMatter ( String ( chunk . contents ) ) , relPath = chunk . hasOwnProperty ( 'data' ) && chunk . data . relativePath ? chunk . data . relativePath : getRelativePath ( chunk . relative ) , absPath = path . normalize ( path . join ( options . basePath , relPath ) ) ; chunk . data = merge . recursive ( { } , options . data , { basePath : options . basePath , relativePath : relPath , path : absPath , urlPath : options . prettyUrls ? path . dirname ( absPath ) + '/' : absPath , srcBasePath : chunk . base , srcRelativePath : chunk . relative , srcPath : chunk . path , contents : '' , draft : false , layout : options . defaultLayout } , chunk . data || { } , matter . data ) ; chunk . contents = new Buffer ( matter . content ) ; chunk . path = path . join ( chunk . base , relPath ) ; return chunk ; }
merge site data, options data, frontmatter data into chunk data
@param  {object} chunk stream chunk object
@return {object}       chunk with transformed data
merge site data options data frontmatter data into chunk data