Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to access a data file in a plugin generator?

Tags:

plugins

jekyll

I'd like to access a data file I have in the _data folder and use this in a plugin generator, but I'm not sure how. I have:

site.data.projects.each do |project|
  ...
end

But when I try to compile it tells me "undefined method 'projects' for Hash(...) NoMethodError. What is the correct syntax?

like image 808
user3439627 Avatar asked Mar 19 '14 21:03

user3439627


1 Answers

If you post what your _data file looks like I can give you a better answer, but try:

site.data['projects'].each do |project|
  ...
end
like image 103
bwest Avatar answered Nov 11 '22 04:11

bwest