Created
January 11, 2013 15:52
-
-
Save kylerush/4511707 to your computer and use it in GitHub Desktop.
An example of a blog post loop in Jekyll.
This file contains hidden or 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
{% for post in site.posts %} | |
<article class="{% if forloop.first %}first{% elsif forloop.last %}last{% else %}middle{% endif %}"> | |
<div class="article-head"> | |
<h2 class="title"><a href="/{{ post.url }}/" class="js-pjax">{{ post.title }}</a></h2> | |
<p class="date">{{ post.date | date: "%b %d, %Y" }}</p> | |
</div><!--/.article-head--> | |
<div class="article-content"> | |
{{ post.long_description }} | |
<a href="/{{ post.url }}/" class="full-post-link js-pjax">Read more</a> | |
</div><!--/.article-content--> | |
</article> | |
{% if forloop.last %}{% else %}<div class="separater"></div>{% endif %} | |
{% endfor %} |
alternatively, you could do
{% unless forloop.last %}<div class="separater"></div>{% endunless %}
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I was an hour trying the separator for loop.last.. You saved me! Thanks dude!