Last active
December 21, 2015 19:39
-
-
Save aijcoa/6355866 to your computer and use it in GitHub Desktop.
Paginator, Page Numbers, and Excerpts in Jekyll
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
paginate: 5 |
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: post | |
category : personal | |
tagline: "an introduction" | |
tags : [hello] | |
comments: true | |
excerpt: Hello, World! Proin ante nunc, sollicitudin vel auctor at, rhoncus eu mauris. Sed vel posuere lorem. Aliquam vel pharetra est, et tincidunt leo. | |
--- | |
Hello World! This is an example post to show excerpts in jekyll! |
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 %} | |
<div class="blog-index"> | |
<div class="content"> | |
{% assign post = site.posts.first %} | |
{% assign content = post.excerpt %} | |
{% include post_detail.html %} | |
</div> | |
</div> | |
{% endfor %} | |
<!-- Pagination links --> | |
<div class="pagination"> | |
{% if paginator.previous_page %} | |
<a href="/" 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="/page{{ paginator.next_page }}" class="next">Next</a> | |
{% else %} | |
<span class="next ">Next</span> | |
{% endif %} | |
</div> |
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
<!-- Place this file in /_includes/ --> | |
<h1 class="entry-title"> | |
{% if page.title %} | |
<a href="{{ root_url }}{{ page.url }}">{{ page.title }}</a> | |
{% endif %} | |
{% if post.title %} | |
<a href="{{ root_url }}{{ post.url }}">{{ post.title }}</a> | |
{% endif %} | |
</h1> | |
<div class="entry-content">{{ content }}</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment