Skip to content

Instantly share code, notes, and snippets.

@carolineschnapp
Created March 2, 2012 18:37
Show Gist options
  • Save carolineschnapp/1960279 to your computer and use it in GitHub Desktop.
Save carolineschnapp/1960279 to your computer and use it in GitHub Desktop.
Latest Blog Articles
{% comment %}
Edit the 2 values right below: what's your blog handle and how many articles do you want to show?
{% endcomment %}
{% assign your_blog_handle_here = 'news' %}
{% assign how_many_articles_to_show = 5 %}
<!-- START OF LATEST BLOG POSTS -->
<div class="widget" id="widget-latest-blog-posts">
<div class="widget-header">
<h3>Latest Blog Posts</h3>
</div>
<div class="latest-blog-posts-wrapper">
<ul class="latest-blog-posts-list">
{% for article in blogs[your_blog_handle_here].articles limit: how_many_articles_to_show %}
<li>{{ article.title | link_to: article.url }}</li>
{% endfor %}
</ul>
</div>
</div>
<style>
.widget .latest-blog-posts-list {
margin: 0;
list-style: none;
}
.widget .latest-blog-posts-list li {
margin: 0 0 10px 0;
padding: 0 0 10px 0;
border-bottom: dotted 1px #CCC;
background: none;
word-wrap: break-word;
line-height: 1.3em;
list-style: none;
}
</style>
<!-- END OF LATEST BLOG POSTS -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment