i am migrating my website made with php and wordpress in jekyll. everything is going smooth except for some problems i'm having with the blog section.
here what my blog/index.html looks like:
---
layout: posts
---
{% for post in paginator.posts %}
<h2><a href="{{ post.url }}">{{ post.title }}</a></h2>
<p>
<span class="date"><i class="fa fa-date"></i> {{ post.date | date: "%m-%d-%Y"}}</span>
</p>
{{ post.excerpt }}
<a class="more-link" href="{{ post.url }}">Read more...</a>
{% endfor %}
what i would like to happen is that the html of the layout: posts repeats for every {{ post.excerpt }} i have. instead, it just wraps all post excerpt into that single html bit. here's the layout:
<div class="page-container">
<div class="sub-container blog">
<h1>Blog</h1>
<div class="entry">
{{ content }}
</div>
<!-- Pagination links -->
<div class="pagination">
<ul>
{% if paginator.previous_page %}
{% if paginator.previous_page == 1 %}
<li>
<a href="/blog/">Prev</a>
</li>
{% else %}
<li>
<a href="/blog/{{ paginator.previous_page }}">Prev</a>
</li>
{% endif %}
{% else %}
<li>
<span class="disabled">Prev</span>
</li>
{% endif %}
{% if paginator.page == 1 %}
<li>
<span class="active">1</span>
</li>
{% else %}
<li>
<a href="/blog/">1</a>
</li>
{% endif %}
{% for count in (2..paginator.total_pages) %}
{% if count == paginator.page %}
<li>
<span class="active">{{ count }}</span>
</li>
{% else %}
<li>
<a href="/blog/{{ count }}">{{ count }}</a>
</li>
{% endif %}
{% endfor %}
{% if paginator.next_page %}
<li>
<a href="/blog/{{ paginator.next_page }}">Next</a>
</li>
{% else %}
<li>
<span class="disabled">Next</span>
</li>
{% endif %}
</ul>
</div>
</div>
</div>
is there a for loop i have to create with post excerpts? what's the syntax? i have no idea how to achieve this.
thanks!