When I attempt to loop through sorted_articles()
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()
<p>item[:title]</p>
end %>
also
<% for item in sorted_articles() %>
<p>item[:title]</p>
<% end %>
and
<% sorted_articles().each do |item| %>
<p>item[:title]</p>
<% end %>
and finally
<%= sorted_articles().each do |item|
<p>item[:title]</p>
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
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