Implemented pagination of posts.
This commit is contained in:
parent
ef44805b80
commit
2cd5bda1a9
10
README.md
10
README.md
|
@ -18,6 +18,7 @@ This is a plug-and-play Jekyll theme best suited to use on [GitHub Pages](https:
|
||||||
- Fully responsive and mobile optimized base theme
|
- Fully responsive and mobile optimized base theme
|
||||||
- Sass/Coffeescript support using Jekyll 2.0
|
- Sass/Coffeescript support using Jekyll 2.0
|
||||||
- Free hosting on your GitHub Pages user site
|
- Free hosting on your GitHub Pages user site
|
||||||
|
- All the SEO goodies comes in-built
|
||||||
- Markdown blogging
|
- Markdown blogging
|
||||||
- Elegant typography
|
- Elegant typography
|
||||||
- Futura PT fonts (The same fonts which has been used on <https://pixar.com>)
|
- Futura PT fonts (The same fonts which has been used on <https://pixar.com>)
|
||||||
|
@ -26,6 +27,7 @@ This is a plug-and-play Jekyll theme best suited to use on [GitHub Pages](https:
|
||||||
- Disqus commenting
|
- Disqus commenting
|
||||||
- Google Analytics integration
|
- Google Analytics integration
|
||||||
- Fuzzy search across blog posts
|
- Fuzzy search across blog posts
|
||||||
|
- Pagination of posts works out-of-the-box.
|
||||||
- Categorize posts out-of-the box
|
- Categorize posts out-of-the box
|
||||||
- A home widget to show recent GitHub commit
|
- A home widget to show recent GitHub commit
|
||||||
- RSS Feed
|
- RSS Feed
|
||||||
|
@ -71,6 +73,14 @@ categories: [PHP, Laravel]
|
||||||
|
|
||||||
The contegorized content can be shown over this URL: <https://yourgithubusername.github.io/categories/>
|
The contegorized content can be shown over this URL: <https://yourgithubusername.github.io/categories/>
|
||||||
|
|
||||||
|
## Pagination
|
||||||
|
|
||||||
|
Pagination of posts in Reverie works out-of-the-box. You only need to speficy number of posts you want on a single page in `_config.yml` and reverie will take care of the rest.
|
||||||
|
|
||||||
|
```yml
|
||||||
|
paginate: 6
|
||||||
|
```
|
||||||
|
|
||||||
## RSS
|
## RSS
|
||||||
|
|
||||||
The generated [RSS feed](https://en.wikipedia.org/wiki/RSS) of your blog can be found at <https://yourgithubusername.github.io/feed>. You can see the example RSS feed over [here](https://www.amitmerchant.com/feed).
|
The generated [RSS feed](https://en.wikipedia.org/wiki/RSS) of your blog can be found at <https://yourgithubusername.github.io/feed>. You can see the example RSS feed over [here](https://www.amitmerchant.com/feed).
|
||||||
|
|
|
@ -82,9 +82,13 @@ plugins:
|
||||||
- jekyll-sitemap # Create a sitemap using the official Jekyll sitemap gem
|
- jekyll-sitemap # Create a sitemap using the official Jekyll sitemap gem
|
||||||
- jekyll-feed # Create an Atom feed using the official Jekyll feed gem
|
- jekyll-feed # Create an Atom feed using the official Jekyll feed gem
|
||||||
- jekyll-seo-tag
|
- jekyll-seo-tag
|
||||||
|
- jekyll-paginate
|
||||||
|
|
||||||
include: ['_pages']
|
include: ['_pages']
|
||||||
|
|
||||||
|
paginate: 6
|
||||||
|
paginate_path: /page:num/
|
||||||
|
|
||||||
# Exclude these files from your production _site
|
# Exclude these files from your production _site
|
||||||
exclude:
|
exclude:
|
||||||
- Gemfile
|
- Gemfile
|
||||||
|
|
|
@ -13,9 +13,10 @@ This is a plug-and-play Jekyll theme which you can use on GitHub Pages without e
|
||||||
## Features overview
|
## Features overview
|
||||||
|
|
||||||
- Command-line free fork-first workflow, using GitHub.com to create, customize and post to your blog
|
- Command-line free fork-first workflow, using GitHub.com to create, customize and post to your blog
|
||||||
- Fully responsive and mobile optimized base theme (Theme Demo)
|
- Fully responsive and mobile optimized base theme
|
||||||
- Sass/Coffeescript support using Jekyll 2.0
|
- Sass/Coffeescript support using Jekyll 2.0
|
||||||
- Free hosting on your GitHub Pages user site
|
- Free hosting on your GitHub Pages user site
|
||||||
|
- All the SEO goodies comes in-built
|
||||||
- Markdown blogging
|
- Markdown blogging
|
||||||
- Elegant typography
|
- Elegant typography
|
||||||
- Futura PT fonts (The same fonts which has been used on <https://pixar.com>)
|
- Futura PT fonts (The same fonts which has been used on <https://pixar.com>)
|
||||||
|
@ -24,6 +25,7 @@ This is a plug-and-play Jekyll theme which you can use on GitHub Pages without e
|
||||||
- Disqus commenting
|
- Disqus commenting
|
||||||
- Google Analytics integration
|
- Google Analytics integration
|
||||||
- Fuzzy search across blog posts
|
- Fuzzy search across blog posts
|
||||||
|
- Pagination of posts works out-of-the-box.
|
||||||
- Categorize posts out-of-the box
|
- Categorize posts out-of-the box
|
||||||
- A home widget to show recent GitHub commit
|
- A home widget to show recent GitHub commit
|
||||||
- RSS Feed
|
- RSS Feed
|
||||||
|
|
30
index.html
30
index.html
|
@ -2,9 +2,8 @@
|
||||||
layout: default
|
layout: default
|
||||||
---
|
---
|
||||||
|
|
||||||
<!--<div id="gh-latest"></div>-->
|
|
||||||
<div class="posts">
|
<div class="posts">
|
||||||
{% for post in site.posts %}
|
{% for post in paginator.posts %}
|
||||||
<article class="post">
|
<article class="post">
|
||||||
|
|
||||||
<h1><a href="{{ site.baseurl }}{{ post.url }}">{{ post.title }}</a></h1>
|
<h1><a href="{{ site.baseurl }}{{ post.url }}">{{ post.title }}</a></h1>
|
||||||
|
@ -20,4 +19,31 @@ layout: default
|
||||||
<a href="{{ site.baseurl }}{{ post.url }}" class="read-more">Read More</a>
|
<a href="{{ site.baseurl }}{{ post.url }}" class="read-more">Read More</a>
|
||||||
</article>
|
</article>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
|
<!-- pagination -->
|
||||||
|
{% if paginator.total_pages > 1 %}
|
||||||
|
<div class="pagination">
|
||||||
|
{% if paginator.previous_page %}
|
||||||
|
<a href="{{ paginator.previous_page_path | prepend: site.baseurl | replace: '//', '/' }}">« Prev</a>
|
||||||
|
{% else %}
|
||||||
|
<span>« Prev</span>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% for page in (1..paginator.total_pages) %}
|
||||||
|
{% if page == paginator.page %}
|
||||||
|
<span class="webjeda">{{ page }}</span>
|
||||||
|
{% elsif page == 1 %}
|
||||||
|
<a href="/">{{ page }}</a>
|
||||||
|
{% else %}
|
||||||
|
<a href="{{ site.paginate_path | prepend: site.baseurl | replace: '//', '/' | replace: ':num', page }}">{{ page }}</a>
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
|
{% if paginator.next_page %}
|
||||||
|
<a href="{{ paginator.next_page_path | prepend: site.baseurl | replace: '//', '/' }}">Next »</a>
|
||||||
|
{% else %}
|
||||||
|
<span>Next »</span>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
|
20
style.scss
20
style.scss
|
@ -690,6 +690,26 @@ Modules - reusable parts of our design
|
||||||
color: #fff;
|
color: #fff;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.pagination a, .pagination span {
|
||||||
|
padding: 7px 18px;
|
||||||
|
border: 1px solid #eee;
|
||||||
|
margin-left: -2px;
|
||||||
|
margin-right: -2px;
|
||||||
|
background-color: #ffffff;
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pagination a {
|
||||||
|
&:hover {
|
||||||
|
background-color: #f1f1f1;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.pagination {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
@media only screen and (min-width: 320px) and (max-width: 759px) {
|
@media only screen and (min-width: 320px) and (max-width: 759px) {
|
||||||
#carbonads {
|
#carbonads {
|
||||||
float: none;
|
float: none;
|
||||||
|
|
Loading…
Reference in New Issue