Skip to content

Instantly share code, notes, and snippets.

@aijcoa
Last active December 21, 2015 19:39
Show Gist options
  • Save aijcoa/6355866 to your computer and use it in GitHub Desktop.
Save aijcoa/6355866 to your computer and use it in GitHub Desktop.
Paginator, Page Numbers, and Excerpts in Jekyll
---
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!
---
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>
<!-- 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