Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attributes is empty #91

Open
bsde1234 opened this issue Feb 17, 2023 · 3 comments
Open

Attributes is empty #91

bsde1234 opened this issue Feb 17, 2023 · 3 comments

Comments

@bsde1234
Copy link

bsde1234 commented Feb 17, 2023

When I tried to get contents of a yml file, attributes is empty, but body have contents

@jxson
Copy link
Owner

jxson commented Feb 21, 2023

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.

@bsde1234
Copy link
Author

bsde1234 commented Feb 22, 2023

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)

})


@bsde1234
Copy link
Author

bsde1234 commented Feb 27, 2023

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants