Last active
October 17, 2016 12:14
-
-
Save skinnylatte/d80e81caeb541229eca201d9d5b2820e to your computer and use it in GitHub Desktop.
Jekyll index file template with pagination and nice dates
This file contains 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
--- | |
layout: default | |
--- | |
<!-- This loops through the paginated posts --> | |
{% for post in paginator.posts %} | |
<h1><a href="{{ site.baseurl }}{{ post.url }}">{{ post.title }}</a></h1> | |
<p class="author"> | |
<span class="date">Written on {{ post.date | date: "%B %e, %Y" }}</span> | |
</p> | |
<div class="content"> | |
{{ post.content }} | |
</div> | |
{% endfor %} | |
<!-- Pagination links --> | |
<div class="pagination"> | |
{% if paginator.previous_page %} | |
<a href="{{ paginator.previous_page_path }}" class="previous">Previous</a> | |
{% else %} | |
<span class="previous">Previous</span> | |
{% endif %} | |
<span class="page_number ">Page: {{ paginator.page }} of {{ paginator.total_pages }}</span> | |
{% if paginator.next_page %} | |
<a href="{{ paginator.next_page_path }}" class="next">Next</a> | |
{% else %} | |
<span class="next ">Next</span> | |
{% endif %} | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Added
{{ site.baseurl }}
to make permalinks work.