Issue #2: Added latest-posts.html.twig

This commit is contained in:
Oliver Davies 2015-04-01 00:03:45 +01:00
parent d0e1b4cb12
commit b4246bec69
2 changed files with 13 additions and 0 deletions

View file

@ -20,6 +20,10 @@
</div>
{% endblock %}
{% block sidebar %}
{% include 'latest-posts' %}
{% endblock %}
<footer class="container" role="contentinfo">
<p class="copyright">&copy; 2010&ndash;{{ 'now'|date('Y') }} {{ site.title }}</p>
</footer>

View file

@ -0,0 +1,9 @@
{% if data.posts %}
<h2>Latest Posts</h2>
<ul>
{% for post in data.posts | slice(0,5) %}
<li{% if page.url == post.url %} class="active"{% endif %}><a href="{{ post.url }}">{{ post.title }}</a></li>
{% endfor %}
</ul>
{% endif %}