Created
January 4, 2012 04:45
-
-
Save gonzedge/1558550 to your computer and use it in GitHub Desktop.
Writing elegant HTML with HAML
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div id="single_post"> | |
<h2 class="post_title"><%= link_to post.title, post %></h2> | |
<div class="post_content"> | |
<div class="post_date"> | |
Posted on <%= post.date.strftime '%e %B %Y' %> | |
</div> | |
<div class="posted_by"> | |
By: <%= post.author %> | |
</div> | |
<div class="comments_number"> | |
<%= post.comment_count %> | |
</div> | |
<% if summary %> | |
<%= post.summary_html %> | |
<%= link_to post do %> | |
Continue Reading » | |
<% end %> | |
<% else %> | |
<%= post.content_html %> | |
<% end %> | |
<ul class="post_tags"> | |
<% post.tags.each do |tag| %> | |
<li> | |
<a href="<%= tag_path(tag) %>"> | |
<%= tag.name %> | |
</a> | |
</li> | |
</ul> | |
</div> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#single_post | |
%h2.post_title= link_to post.title, post | |
.post_content | |
.post_date | |
Posted on #{post.date.strftime '%e %B %Y'} | |
.posted_by | |
By: #{post.author} | |
.comments_number= post.comment_count | |
- if summary | |
= post.summary_html | |
= link_to post do | |
Continue Reading » | |
- else | |
= post.content_html | |
%ul.post_tags | |
- post.tags.each do |tag| | |
%li | |
%a{href: "/blog/tag/#{tag.name}"}= tag.name |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment