artemsheludko
6/30/2018 - 6:58 AM

Example of a blog post loop in Jekyll ( Пример цикла в посте на Jekyll)

Example of a blog post loop in Jekyll ( Пример цикла в посте на Jekyll)

{% for post in site.posts %}
  <article class="{% if forloop.first %}first{% elsif forloop.last %}last{% else %}middle{% endif %}">
		<div class="">
			<h2 class="title"><a href="/{{ post.url }}/" class="">{{ 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="">Read more</a>	
		</div> <!--/.article-content-->
	</article>
	{% if forloop.last %}{% else %}<div class="separater"></div>{% endif %}
{% endfor %}

<!-- or alternatively -->
{% unless forloop.last %}<div class="separater"></div>{% endunless %}