'Latest' items

Do you need to display the most recent items in a section or your launch.ly site? Here is how you do it …

Have you ever wanted to display the most recent items in a section?

We recently needed one for our own blog so we created a ‘latest’ tag. Here is how you use it …

All you need to do is to pass in the link for the section you are after and the total number of items you need and you will get the latest items for that section. If you need to see it in action, check out the bottom of dev.launch.ly. In fact that is the exact snippet we use!

1<ul>
2{% latest link: /store, total: 2 %}
3  <li>{{ item.contents.first.title | link: item.url }}</li>
4{% endlatest %}
5</ul>

by Craig Sullivan
launch.ly

21 Mar 2012