Hello all,
I am trying to customize the format of a latest_articles bit of code. I
only want the image and the title of the article to display, so I wrote
this snippet:
= latest_articles(3).each do |article|
.recent_entry
- unless article.metadata('Image').nil?
%a{ :href => '#' }
%img{ :src => article.metadata('Image'), :alt => article.heading }
%h4= article.heading
It outputs just fine, but after the output I get the full contents of the
three articles files. Is there a way to not display all of that extra
stuff? You can see an example of the running code at
http://mobous.herokuapp.com/ at the bottom of the page on the left in the
footer.
--
Dave Long
Web Application Consultant
(203) 626-1809
www.davejlong.com
Try changing that first line to a - instead of = ? --- Wynn Netherland web: http://wynn.fm twitter / skype / facebook: pengwynn linkedin: http://linkedin.com/in/netherland On Friday, January 20, 2012 at 8:51 AM, David Long wrote: > Hello all, > I am trying to customize the format of a latest_articles bit of code. I only want the image and the title of the article to display, so I wrote this snippet: > > = latest_articles(3).each do |article| > > .recent_entry > > > - unless article.metadata('Image').nil? > > > > > > > > > > %a{ :href => '#' } > > > > > > > > > %img{ :src => article.metadata('Image'), :alt => article.heading } > > > > > > %h4= article.heading > > It outputs just fine, but after the output I get the full contents of the three articles files. Is there a way to not display all of that extra stuff? You can see an example of the running code at http://mobous.herokuapp.com/ at the bottom of the page on the left in the footer. > > -- > > Dave Long > Web Application Consultant > > (203) 626-1809 > www.davejlong.com (http://www.davejlong.com)
Thanks Wynn. That worked. I knew it was something silly like that, but am still new to Ruby and HAML. On Fri, Jan 20, 2012 at 9:53 AM, Wynn Netherland <wynn.netherland@gmail.com>wrote: > Try changing that first line to a - instead of = ? > > --- > Wynn Netherland > web: http://wynn.fm > twitter / skype / facebook: pengwynn > linkedin: http://linkedin.com/in/netherland > > > > On Friday, January 20, 2012 at 8:51 AM, David Long wrote: > > > Hello all, > > I am trying to customize the format of a latest_articles bit of code. I > only want the image and the title of the article to display, so I wrote > this snippet: > > > > = latest_articles(3).each do |article| > > > .recent_entry > > > > - unless article.metadata('Image').nil? > > > > > > > > > > > > > %a{ :href => '#' } > > > > > > > > > > > %img{ :src => article.metadata('Image'), :alt => article.heading > } > > > > > > > > %h4= article.heading > > > > It outputs just fine, but after the output I get the full contents of > the three articles files. Is there a way to not display all of that extra > stuff? You can see an example of the running code at > http://mobous.herokuapp.com/ at the bottom of the page on the left in the > footer. > > > > -- > > > > Dave Long > > Web Application Consultant > > > > (203) 626-1809 > > www.davejlong.com (http://www.davejlong.com) > > > > -- Dave Long Web Application Consultant (203) 626-1809 www.davejlong.com