Skip to content

Instantly share code, notes, and snippets.

@did
Created February 19, 2011 00:24
Show Gist options
  • Save did/834667 to your computer and use it in GitHub Desktop.
Save did/834667 to your computer and use it in GitHub Desktop.
I'm using tumblr as my blog engine and display the last 3 posts in my locomotive index page
{% consume blog from "http://blog.locomotiveapp.org/api/read/json?num=3&type=text", expires_in: 3000 %}
{% if blog == null %}
<p class="error">We are sorry but the Tumblr API seems to be broken now. Click <a href="http://blog.locomotiveapp.org">here</a> to see the blog.</p>
{% else %}
{% for article in blog.posts %}
<li class="article {% cycle ' ', ' ', 'last' %}">
<h3><a href="{{ article.url }}">{{ article.regular_title }}</a></h3>
<p class="date">{{ article.date_gmt | localized_date: '%A %d %B %Y', 'en' }}</p>
<div class="body">
{{ article.regular_body | strip_html | truncate: 200 }}
</div>
</li>
{% endfor %}
{% endif %}
{% endconsume %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment