Skip to content

Commit 6e9de53

Browse files
committed
Update pagination
1 parent 60ed29e commit 6e9de53

File tree

10 files changed

+93
-48
lines changed

10 files changed

+93
-48
lines changed

Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ group :jekyll_plugins do
33
gem 'github-pages'
44
gem 'jekyll'
55
gem 'jekyll-email-protect'
6-
gem 'jekyll-paginate'
6+
gem 'jekyll-paginate-v2'
77
gem 'jekyll-scholar'
88
gem 'jemoji'
99
gem 'unicode_utils'

_config.yml

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ last_updated: false # set to true if you want to display last updated in the foo
2020
# -----------------------------------------------------------------------------
2121

2222
navbar_fixed: true
23-
footer_fixed: false
23+
footer_fixed: true
2424
# TODO: add layout settings (single page vs. multi-page)
2525

2626
# -----------------------------------------------------------------------------
@@ -43,16 +43,17 @@ google_analytics: UA-XXXXXXXXX # out your google-analytics code
4343

4444
blog_name: al-folio
4545
blog_description: a simple whitespace theme for academics
46-
47-
# Pagination
48-
paginate: 4
4946
permalink: /blog/:year/:title/
50-
paginate_path: /blog/page:num/
5147

52-
text:
53-
pagination:
54-
newer: 'Newer'
55-
older: 'Older'
48+
# Pagination
49+
pagination:
50+
enabled: true
51+
collection: 'posts'
52+
permalink: /page/:num/
53+
per_page: 3
54+
trail:
55+
before: 1 # The number of links before the current page
56+
after: 3 # The number of links after the current page
5657

5758
# Comments
5859
disqus_shortname: al-folio # put your disqus shortname
@@ -98,7 +99,7 @@ exclude: [vendor]
9899
# Plug-ins
99100
plugins:
100101
- jekyll-email-protect
101-
- jekyll-paginate
102+
- jekyll-paginate-v2
102103
- jekyll/scholar
103104
- jemoji
104105

_includes/header.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,11 @@
4141
</li>
4242
<!-- Other pages -->
4343
{% for p in site.pages %}
44-
{% if p.title and p.url != "/" %}
44+
{% if p.nav %}
4545
<li class="nav-item {% if page.title == p.title %}active{% endif %}">
4646
<a class="nav-link" href="{{ p.url | prepend: site.baseurl | prepend: site.url }}">
4747
{{ p.title }}
48-
{% if page.nav == p.nav %}
48+
{% if page.title == p.title %}
4949
<span class="sr-only">(current)</span>
5050
{% endif %}
5151
</a>

_includes/pagination.html

Lines changed: 15 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,17 @@
1-
{% if paginator.total_pages != 1 %}
2-
<div class="pagination clearfix mb1 mt4">
3-
<div class="left">
4-
{% if paginator.previous_page %}
5-
{% if paginator.page == 2 %}
6-
<a class="pagination-item" href="{{ site.baseurl }}/blog/">{{ site.text.pagination.newer }}</a>
7-
{% else %}
8-
<a class="pagination-item" href="{{ paginator.previous_page_path | prepend: site.baseurl }}">{{ site.text.pagination.newer }}</a>
9-
{% endif %}
10-
{% else %}
11-
<span class="pagination-item disabled">{{ site.text.pagination.newer }}</span>
1+
{% if paginator.total_pages > 1 %}
2+
<nav aria-label="Blog page naviation">
3+
<ul class="pagination pagination-lg justify-content-center">
4+
<li class="page-item {% unless paginator.previous_page %}disabled{% endunless %}">
5+
<a class="page-link" href="{{ paginator.previous_page_path | prepend: site.baseurl }}" tabindex="-1" aria-disabled="{{ paginator.previous_page }}">Newer</a>
6+
</li>
7+
{% if paginator.page_trail %}
8+
{% for trail in paginator.page_trail %}
9+
<li class="page-item {% if page.url == trail.path %}active{% endif %}"><a class="page-link" href="{{ trail.path | prepend: site.baseurl }}" title="{{trail.title}}">{{ trail.num }}</a></li>
10+
{% endfor %}
1211
{% endif %}
13-
</div>
14-
<div class="right">
15-
{% if paginator.next_page %}
16-
<a class="pagination-item" href="{{ paginator.next_page_path | prepend: site.baseurl }}">{{ site.text.pagination.older }}</a>
17-
{% else %}
18-
<span class="pagination-item disabled">{{ site.text.pagination.older }}</span>
19-
{% endif %}
20-
</div>
21-
<div class="pagination-meta">Page {{ paginator.page }} of {{ paginator.total_pages }}</div>
22-
</div>
12+
<li class="page-item {% unless paginator.next_page %}disabled{% endunless %}">
13+
<a class="page-link" href="{{ paginator.next_page_path | prepend: site.baseurl }}">Older</a>
14+
</li>
15+
</ul>
16+
</nav>
2317
{% endif %}

_layouts/about.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
{% if page.profile %}
1010
<div class="profile col-4 {% if page.profile.align == 'left' %}order-first{% endif %}">
1111
{% if page.profile.image %}
12-
<img src="{{ page.profile.image | prepend: '/assets/img/' | prepend: site.baseurl | prepend: site.url }}">
12+
<img class="img-fluid z-depth-1 rounded" src="{{ page.profile.image | prepend: '/assets/img/' | prepend: site.baseurl | prepend: site.url }}">
1313
{% endif %}
1414
{% if page.profile.address %}
1515
<div class="address">

_pages/projects.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ layout: page
33
title: projects
44
permalink: /projects/
55
description: A growing collection of your cool projects.
6+
nav: true
67
---
78

89
{% for project in site.projects %}

_pages/publications.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ permalink: /publications/
44
title: publications
55
description: Publications by categories in reversed chronological order. Generated by jekyll-scholar.
66
years: [1956, 1950, 1935, 1905]
7+
nav: true
78
---
89

910
{% for y in page.years %}

_pages/teaching.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ layout: page
33
permalink: /teaching/
44
title: teaching
55
description: Materials for courses you taught. Replace this text with your description.
6+
nav: true
67
---
78

89
For now, this page is assumed to be a static description of your courses. You can convert it to a collection similar to `_projects/` so that you can have a dedicated page for each course.

_sass/_base.scss

Lines changed: 57 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
// Typography
66

77
a, table.table a {
8-
color: $link-color;
8+
color: $theme-color;
99
display: inline-block;
1010
&:hover {
11-
color: $link-color;
11+
color: $theme-color;
1212
text-decoration: underline;
1313
}
1414
&:hover:after {
@@ -17,6 +17,7 @@ a, table.table a {
1717
}
1818

1919
// Math
20+
2021
.equation {
2122
margin-bottom: 1rem;
2223
text-align: center;
@@ -26,9 +27,6 @@ a, table.table a {
2627
// Profile
2728

2829
.profile {
29-
img {
30-
box-shadow: 0 0 5px $grey-color;
31-
}
3230
.address {
3331
font-family: monospace;
3432
font-size: 1.2rem;
@@ -46,7 +44,6 @@ a, table.table a {
4644
border-bottom: 1px solid $grey-color-light;
4745
opacity: 0.95;
4846
}
49-
5047
.navbar.navbar-light {
5148
// Remove link decoration
5249
a {
@@ -56,23 +53,23 @@ a, table.table a {
5653
}
5754
.navbar-nav .nav-item .nav-link {
5855
&:hover {
59-
color: $link-color;
56+
color: $theme-color;
6057
}
6158
}
6259
.navbar-nav .nav-item.active>.nav-link {
6360
background-color: inherit;
64-
color: $link-color;
61+
color: $theme-color;
6562
font-weight: bolder;
6663
&:hover {
67-
color: $link-color;
64+
color: $theme-color;
6865
}
6966
}
7067
.contact-icon {
7168
font-size: 2rem;
7269
a {
7370
color: $grey-color-dark;
7471
&:hover {
75-
color: $link-color;
72+
color: $theme-color;
7673
}
7774
}
7875
}
@@ -115,19 +112,22 @@ a, table.table a {
115112

116113

117114
// News
115+
118116
.news table td {
119117
font-size: 1rem;
120118
}
121119

120+
122121
// Social (bottom)
122+
123123
.social {
124124
text-align: center;
125125
.contact-icon {
126126
font-size: 4rem;
127127
a {
128128
color: $grey-color-dark;
129129
&:hover {
130-
color: $link-color;
130+
color: $theme-color;
131131
}
132132
}
133133
}
@@ -147,7 +147,7 @@ footer.fixed-bottom {
147147
a {
148148
color: white;
149149
&:hover {
150-
color: lighten($link-color, 25%);
150+
color: lighten($theme-color, 25%);
151151
text-decoration: none;
152152
}
153153
}
@@ -159,3 +159,48 @@ footer.sticky-bottom {
159159
padding-bottom: 40px;
160160
font-size: 0.9rem;
161161
}
162+
163+
164+
// Blog
165+
166+
.header-bar {
167+
border-bottom: 1px solid $grey-color-light;
168+
text-align: center;
169+
padding-top: 2rem;
170+
padding-bottom: 5rem;
171+
h1 {
172+
color: $theme-color;
173+
font-size: 5rem;
174+
}
175+
}
176+
177+
.post-list {
178+
margin: 0;
179+
margin-bottom: 40px;
180+
padding: 0;
181+
li {
182+
border-bottom: 1px solid $grey-color-light;
183+
list-style: none;
184+
padding-top: 2rem;
185+
padding-bottom: 2rem;
186+
.post-meta {
187+
color: $grey-color;
188+
font-size: 0.875rem;
189+
margin-bottom: 0;
190+
}
191+
a {
192+
color: black;
193+
text-decoration: none;
194+
&:hover {
195+
color: $theme-color;
196+
}
197+
}
198+
}
199+
}
200+
201+
.pagination .page-item.active .page-link {
202+
background-color: $theme-color;
203+
&:hover {
204+
background-color: $theme-color;
205+
}
206+
}

blog/index.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
---
22
layout: default
3+
pagination:
4+
enabled: true
35
---
46

57
<div class="post">
@@ -13,7 +15,7 @@ <h2>{{ site.blog_description }}</h2>
1315
<ul class="post-list">
1416
{% for post in paginator.posts %}
1517
<li>
16-
<h2><a class="post-title" href="{{ post.url | prepend: site.baseurl }}">{{ post.title }}</a></h2>
18+
<h3><a class="post-title" href="{{ post.url | prepend: site.baseurl }}">{{ post.title }}</a></h3>
1719
<p class="post-meta">{{ post.date | date: '%B %-d, %Y' }}</p>
1820
<p>{{ post.description }}</p>
1921
</li>

0 commit comments

Comments
 (0)