Create pages from yaml data


#1

Hi all. Tell me, can jekyll generate pages from a yaml file as middleman

example in middleman

data/people.yml
friends:

  • url: tom_url.html
    name: Tom
    age: 30

  • url: dick_url.html
    name: Dick
    age: 20

config.rb
data.people.friends.each do |friend|
proxy “#{friend.url}”, “friend_detail_template.html”, locals: { friend: friend }
end

it will automatically generate pages: tom_url.html and dick_url.html
and through the locals, will access the properties of the object

tom_url.html

friend.name >> Tom
friend.age >> 30


#2

As far I know, you can by writing custom plugin in _plugins directory.


#3

Seems that can be the way, as I see at http://jimpravetz.com/blog/2011/12/generating-jekyll-pages-from-data/


#4

I think the solution is jekyll-datapage_gen.

It includes a working example too.