Middleman Blog adding data to html after loop

Hello!

I have been using Middleman for basic static sites for a while, but just set up of my first site using a blog. Everything seems to work fine, but I have one random issue: At the end of my basic loop:

.wrapper
  = blog.articles.each do |project|
    %h1= project.title

The data returns successfully, but for some reason Middleman also inserts the object via html at the end of the loop:

<middleman::blog::blogarticle: {"title"="">"Clinical Pharmacology", "role"=&gt;"Lead UI Design", "year"=&gt;2014, "date"=&gt;"10/5/2015", "client"=&gt;"Elsevier", "project_type"=&gt;"Waterfall"}&gt;, #<middleman::blog::blogarticle: {"title"="">"Wave", "role"=&gt;"Lead UI Design", "year"=&gt;"2015", "date"=&gt;"10/5/2015", "client"=&gt;"DTV", "project_type"=&gt;"Retainer"}&gt;]
</middleman::blog::blogarticle:></middleman::blog::blogarticle:>

However when I switch my template language to ERB, this problem no longer persists. Anyone experienced something like this before?

About 30 seconds after I created this I realized my problem was not understanding haml. I’ve since fixed my stupid mistake! I can’t find a way to delete this post, but if an admin sees this, feel free to do so. Thanks!

I hit this, too, and I still don’t know what I’m missing. How did you fix this?

(I hope nobody deletes this, one of the advantages of publicly available Q&A forums is documentation of answers to common mistakes/misunderstandings. It’s better to document the resolution for others!)

Found it. Syntax error with the top of the loop (using =) that causes code to be evaluated and also inserted into the document. So the object is returned. Using - keeps the result of the evaluation from being inserted.

So instead of:

= blog.articles.each do |project|

it should lead with -

- blog.articles.each do |project|