RhysO RhysO - 1 year ago 66
Ruby Question

Embedding Ruby into a nanoc site doesn't work

When I attempt to loop through

in Ruby, the embedded code just stays the same and doesn't get compiled in the output when I run
nanoc compile
. Why is this? Am I embedding it wrong? I've tried all the variations below:

<%= for item in sorted_articles()
end %>


<% for item in sorted_articles() %>
<% end %>


<% sorted_articles().each do |item| %>
<% end %>

and finally

<%= sorted_articles().each do |item|
end %>

I also followed a tutorial here pretty much exactly as I found it, but still no luck! The routing is working, so are the rules, and everything else. Just this damn loop!

Thanks. The source can be found on gitlab and the live site can be found here

Answer Source

The compile rule for all .html files wasn't being passed through the erb filter, and as Sergio mentioned in the comments, the code was being ignored. Adding the filter :erb fixed the issue

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download