Skip to content

Commit

Permalink
Add pagination template for blog posts
Browse files Browse the repository at this point in the history
  • Loading branch information
chriskyfung committed Feb 21, 2021
1 parent da0c4a6 commit 811d15a
Show file tree
Hide file tree
Showing 2 changed files with 91 additions and 4 deletions.
19 changes: 15 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,23 @@ This theme includes Jekyll plugins that are not in the whitelist of Github Pages
1. Deploy disqus-amp.html to another domain or subdoamin.
2. Copy the external URL link as the value of `amp_disqus_url` in _config.yml.

### Enabling Pagination for Blog Posts
1. Make a new folder named _blog_ in your root directory.
2. Create an empty HTML file in the new folder and name it to **index.html**.
3. Copy the following front matter to the HTML file:

```html
---
layout: blog-pagination
---
```

### Enabling Lists of Categories and Tags
1. In your root directory, create a folder named __category__ and __tag__, respectively.
2. New a file and name it to **index.html** in your __category__ and/or __tag__ folder(s).
1. In your root directory, create a folder named _category_ and _tag_, respectively.
2. New a file and name it to **index.html** in your _category_ and/or _tag_ folder(s).
3. Copy the following front matters to the corresponding **index.html**:

- For __category/index.html__,
- For _category/index.html_,

```html
---
Expand All @@ -109,7 +120,7 @@ This theme includes Jekyll plugins that are not in the whitelist of Github Pages
---
```

- For __tag/index.html__
- For _tag/index.html_

```html
---
Expand Down
76 changes: 76 additions & 0 deletions _layouts/blog-pagination.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
---
layout: default
---

<!-- Featured
================================================== -->
<section class="featured-posts">

<div class="section-title">
<h2><span>Featured</span></h2>
</div>

<div class="row listfeaturedtag">

{% for post in site.posts %}

{% if post.featured == true %}

{% include featuredbox.html %}

{% endif %}

{% endfor %}

</div>

</section>

<!-- Posts Index
================================================== -->
{% if paginator.previous_page %}
{% if paginator.previous_page > 0 %}
<div id="jumptopageof"></div>
{% endif %}
{% endif %}

<section class="recent-posts row">

<div class="col-sm-4 left-sidebar">
{% include sidebar.html %}
</div>

<div class="col-sm-8">

<div class="section-title">
<h2><span>All Stories</span></h2>
</div>

<div class="masonrygrid row listrecent">

{% for post in paginator.posts %}

{% unless post.featured == true %}

{% include postbox.html %}

{% endunless %}

{% endfor %}

</div>

<!-- Pagination -->
<div class="bottompagination">

<span class="navigation" role="navigation">

{% include pagination.html basepath="blog/"%}

</span>

</div>

</div>

</section>

0 comments on commit 811d15a

Please sign in to comment.