Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Embedding Ruby into a nanoc site doesn't work

Tags:

html

ruby

erb

nanoc

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

like image 246
TechnicalTophat Avatar asked Oct 13 '16 14:10

TechnicalTophat


1 Answers

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

like image 195
TechnicalTophat Avatar answered Sep 21 '22 06:09

TechnicalTophat