front-matter
front-matter copied to clipboard
Attributes is empty
When I tried to get contents of a yml file, attributes is empty, but body have contents
Could you provide an example set of content that yeilds the same result? I can use it to debug and maybe set up a regression test if there is a bug.
title: "xxxxxx xxx"
url: "https://xxxxx.com/xx"
email: "[email protected]"
markdown: kramdown
mobile: "xxxxxxx"
country: "xxxx"
currency_code: "xx"
style: compressed
defaults:
- scope:
type: posts
values:
layout: product
- scope:
type: products
values:
layout: post
encoding: UTF-8
favicon: "logo.png"
var fs = require('fs')
, fm = require('front-matter')
fs.readFile('../xxxx/xx/_config.yml', 'utf8', function(err, data2){
if (err) throw err
var content2 = fm(data2)
console.log(content2)
})
Hello, any updates? I get like below
{
attributes: {},
body: 'title: "xxxx xxxx"\n' +
'url: "https://xxxxx.com/crr"\n' +
'email: "[email protected]"\n' +
'markdown: xxxx\n' +
'mobile: "xxxxx"\n' +
'country: "xxxx"\n' +
'currency_code: "xxxx"\n' +
'location: "xxxxxx"\n' +
'sass:\n' +
' sass_dir: _sass\n' +
' style: compressed\n' +
'collections:\n' +
' products:\n' +
' output: true\n' +
'defaults:\n' +
' - scope:\n' +
' type: posts\n' +
' values:\n' +
' layout: product\n' +
' - scope:\n' +
' type: products\n' +
' values:\n' +
' layout: post\n' +
'encoding: UTF-8\n' +
'paginate: 10\n' +
"paginate_path: 'page/:num/'\n" +
'favicon: "https://xxxxx.com/crr/xxxx.png"\n' +
'adsense: ',
bodyBegin: 1
}
How to get body->url from above code?