   for file in fs.readdirSync layoutDir
     name = path.basename file, path.extname file
     { data, content } = getDataAndContent path.join(layoutDir, file)
+    data or= {}
     fileData[name] = data
     fileContents[name] = content
 


# Get the frontmatter plus content of a file
getDataAndContent = (filepath) ->
  lines = fs.readFileSync(filepath).toString().split(/\r\n|\n|\r/)
  data = {}
  if /^---\s?$/.test lines[0]
    lines.shift()
    frontMatter = []

        data = { value: data }

  data: data
  content: if data then lines.join("\n") else content
  ext: path.extname filepath

getPermalink = (post, style) ->
