2

I'm trying to build a site with Hexo from list of pages from an array of objects instead a folder.

I'd like to use hexo just because I don't want to reinvent the wheel and because it seems to be very handful, but I didn't got how to pass a json object and save in a site folder.

var data = {
    title: 'Buttons',
    name: 'block-name',
    category: 'Category name / Sub category',
    description: 'This is the description of the element\n and you can write text just like this.',
    otherProperty: 'Hello'
};

hexo = new Hexo(process.cwd(), {
    debug: true,
    config: '_config.yml'
});
hexo.init().then(function(){
    hexo.post.create(data, false);
});

The api hexo.post.create creates the source files, not the final html file, I'm not sure if this is possible and how I can tell to Hexo how to do it.

Basically, I would pass the data to the template I'll use to create the pages, is that possible?

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
vitto
  • 19,094
  • 31
  • 91
  • 130

0 Answers0