Okay, so after some digging, I came across two posts that helped me understand how dynamic pages work with a middleman. (Unfortunately, not many examples of doco and Middleman for dynamic pages are really basic)
http://benfrain.com/understanding-middleman-the-static-site-generator-for-faster-prototyping/ http://forum.middlemanapp.com/discussion/134/best-way-to-use-yaml- same-html-but-parameter-driven-data-fixed / p1
My decision...
data / projects.yml (contains project information)
details: - client: "Company X" title: "Company X Event" video_url: "" logo: - "logo_companyx.gif" image_path: "/img/projects/companyx" total_images: 10 content: "<p>Blah blah blah</p>" responsibilities: "<li>Something</li> <li>Some task</li>"
config.rb:
data.projects.details.each do |pd| proxy "/projects/#{pd[:client]}.html", "/projects/template.html", :layout => false, :locals => { :project => pd }, :ignore => true end
The trick with the fragment above transfers the entire project data object to the template through a proxy server using locales and sets the layout to false so that it does not inherit the default site layout (since I - or the client rather - want to display them in a pop-up lightbox )
The last step of the process was to create /projects/template.html.erb (in the source folder), declaring the following at the top of the template
<% p = locals[:project] %>
This allowed me to output every property of the p object in template.html.erb.
eg:
<%= p[:title] %>
I hope this helps someone, as it took me several days to play, and ANY search on the Internet, for example, or tips.
source share