Update pagination

This commit is contained in:
Maruan Al-Shedivat 2020-05-02 18:09:42 -04:00
parent 60ed29eb5b
commit 6e9de53d68
10 changed files with 93 additions and 48 deletions

View File

@ -3,7 +3,7 @@ group :jekyll_plugins do
gem 'github-pages' gem 'github-pages'
gem 'jekyll' gem 'jekyll'
gem 'jekyll-email-protect' gem 'jekyll-email-protect'
gem 'jekyll-paginate' gem 'jekyll-paginate-v2'
gem 'jekyll-scholar' gem 'jekyll-scholar'
gem 'jemoji' gem 'jemoji'
gem 'unicode_utils' gem 'unicode_utils'

View File

@ -20,7 +20,7 @@ last_updated: false # set to true if you want to display last updated in the foo
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
navbar_fixed: true navbar_fixed: true
footer_fixed: false footer_fixed: true
# TODO: add layout settings (single page vs. multi-page) # TODO: add layout settings (single page vs. multi-page)
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
@ -43,16 +43,17 @@ google_analytics: UA-XXXXXXXXX # out your google-analytics code
blog_name: al-folio blog_name: al-folio
blog_description: a simple whitespace theme for academics blog_description: a simple whitespace theme for academics
permalink: /blog/:year/:title/
# Pagination # Pagination
paginate: 4 pagination:
permalink: /blog/:year/:title/ enabled: true
paginate_path: /blog/page:num/ collection: 'posts'
permalink: /page/:num/
text: per_page: 3
pagination: trail:
newer: 'Newer' before: 1 # The number of links before the current page
older: 'Older' after: 3 # The number of links after the current page
# Comments # Comments
disqus_shortname: al-folio # put your disqus shortname disqus_shortname: al-folio # put your disqus shortname
@ -98,7 +99,7 @@ exclude: [vendor]
# Plug-ins # Plug-ins
plugins: plugins:
- jekyll-email-protect - jekyll-email-protect
- jekyll-paginate - jekyll-paginate-v2
- jekyll/scholar - jekyll/scholar
- jemoji - jemoji

View File

@ -41,11 +41,11 @@
</li> </li>
<!-- Other pages --> <!-- Other pages -->
{% for p in site.pages %} {% for p in site.pages %}
{% if p.title and p.url != "/" %} {% if p.nav %}
<li class="nav-item {% if page.title == p.title %}active{% endif %}"> <li class="nav-item {% if page.title == p.title %}active{% endif %}">
<a class="nav-link" href="{{ p.url | prepend: site.baseurl | prepend: site.url }}"> <a class="nav-link" href="{{ p.url | prepend: site.baseurl | prepend: site.url }}">
{{ p.title }} {{ p.title }}
{% if page.nav == p.nav %} {% if page.title == p.title %}
<span class="sr-only">(current)</span> <span class="sr-only">(current)</span>
{% endif %} {% endif %}
</a> </a>

View File

@ -1,23 +1,17 @@
{% if paginator.total_pages != 1 %} {% if paginator.total_pages > 1 %}
<div class="pagination clearfix mb1 mt4"> <nav aria-label="Blog page naviation">
<div class="left"> <ul class="pagination pagination-lg justify-content-center">
{% if paginator.previous_page %} <li class="page-item {% unless paginator.previous_page %}disabled{% endunless %}">
{% if paginator.page == 2 %} <a class="page-link" href="{{ paginator.previous_page_path | prepend: site.baseurl }}" tabindex="-1" aria-disabled="{{ paginator.previous_page }}">Newer</a>
<a class="pagination-item" href="{{ site.baseurl }}/blog/">{{ site.text.pagination.newer }}</a> </li>
{% else %} {% if paginator.page_trail %}
<a class="pagination-item" href="{{ paginator.previous_page_path | prepend: site.baseurl }}">{{ site.text.pagination.newer }}</a> {% for trail in paginator.page_trail %}
{% endif %} <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>
{% else %} {% endfor %}
<span class="pagination-item disabled">{{ site.text.pagination.newer }}</span>
{% endif %} {% endif %}
</div> <li class="page-item {% unless paginator.next_page %}disabled{% endunless %}">
<div class="right"> <a class="page-link" href="{{ paginator.next_page_path | prepend: site.baseurl }}">Older</a>
{% if paginator.next_page %} </li>
<a class="pagination-item" href="{{ paginator.next_page_path | prepend: site.baseurl }}">{{ site.text.pagination.older }}</a> </ul>
{% else %} </nav>
<span class="pagination-item disabled">{{ site.text.pagination.older }}</span>
{% endif %}
</div>
<div class="pagination-meta">Page {{ paginator.page }} of {{ paginator.total_pages }}</div>
</div>
{% endif %} {% endif %}

View File

@ -9,7 +9,7 @@ layout: page
{% if page.profile %} {% if page.profile %}
<div class="profile col-4 {% if page.profile.align == 'left' %}order-first{% endif %}"> <div class="profile col-4 {% if page.profile.align == 'left' %}order-first{% endif %}">
{% if page.profile.image %} {% if page.profile.image %}
<img src="{{ page.profile.image | prepend: '/assets/img/' | prepend: site.baseurl | prepend: site.url }}"> <img class="img-fluid z-depth-1 rounded" src="{{ page.profile.image | prepend: '/assets/img/' | prepend: site.baseurl | prepend: site.url }}">
{% endif %} {% endif %}
{% if page.profile.address %} {% if page.profile.address %}
<div class="address"> <div class="address">

View File

@ -3,6 +3,7 @@ layout: page
title: projects title: projects
permalink: /projects/ permalink: /projects/
description: A growing collection of your cool projects. description: A growing collection of your cool projects.
nav: true
--- ---
{% for project in site.projects %} {% for project in site.projects %}

View File

@ -4,6 +4,7 @@ permalink: /publications/
title: publications title: publications
description: Publications by categories in reversed chronological order. Generated by jekyll-scholar. description: Publications by categories in reversed chronological order. Generated by jekyll-scholar.
years: [1956, 1950, 1935, 1905] years: [1956, 1950, 1935, 1905]
nav: true
--- ---
{% for y in page.years %} {% for y in page.years %}

View File

@ -3,6 +3,7 @@ layout: page
permalink: /teaching/ permalink: /teaching/
title: teaching title: teaching
description: Materials for courses you taught. Replace this text with your description. description: Materials for courses you taught. Replace this text with your description.
nav: true
--- ---
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. 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.

View File

@ -5,10 +5,10 @@
// Typography // Typography
a, table.table a { a, table.table a {
color: $link-color; color: $theme-color;
display: inline-block; display: inline-block;
&:hover { &:hover {
color: $link-color; color: $theme-color;
text-decoration: underline; text-decoration: underline;
} }
&:hover:after { &:hover:after {
@ -17,6 +17,7 @@ a, table.table a {
} }
// Math // Math
.equation { .equation {
margin-bottom: 1rem; margin-bottom: 1rem;
text-align: center; text-align: center;
@ -26,9 +27,6 @@ a, table.table a {
// Profile // Profile
.profile { .profile {
img {
box-shadow: 0 0 5px $grey-color;
}
.address { .address {
font-family: monospace; font-family: monospace;
font-size: 1.2rem; font-size: 1.2rem;
@ -46,7 +44,6 @@ a, table.table a {
border-bottom: 1px solid $grey-color-light; border-bottom: 1px solid $grey-color-light;
opacity: 0.95; opacity: 0.95;
} }
.navbar.navbar-light { .navbar.navbar-light {
// Remove link decoration // Remove link decoration
a { a {
@ -56,15 +53,15 @@ a, table.table a {
} }
.navbar-nav .nav-item .nav-link { .navbar-nav .nav-item .nav-link {
&:hover { &:hover {
color: $link-color; color: $theme-color;
} }
} }
.navbar-nav .nav-item.active>.nav-link { .navbar-nav .nav-item.active>.nav-link {
background-color: inherit; background-color: inherit;
color: $link-color; color: $theme-color;
font-weight: bolder; font-weight: bolder;
&:hover { &:hover {
color: $link-color; color: $theme-color;
} }
} }
.contact-icon { .contact-icon {
@ -72,7 +69,7 @@ a, table.table a {
a { a {
color: $grey-color-dark; color: $grey-color-dark;
&:hover { &:hover {
color: $link-color; color: $theme-color;
} }
} }
} }
@ -115,11 +112,14 @@ a, table.table a {
// News // News
.news table td { .news table td {
font-size: 1rem; font-size: 1rem;
} }
// Social (bottom) // Social (bottom)
.social { .social {
text-align: center; text-align: center;
.contact-icon { .contact-icon {
@ -127,7 +127,7 @@ a, table.table a {
a { a {
color: $grey-color-dark; color: $grey-color-dark;
&:hover { &:hover {
color: $link-color; color: $theme-color;
} }
} }
} }
@ -147,7 +147,7 @@ footer.fixed-bottom {
a { a {
color: white; color: white;
&:hover { &:hover {
color: lighten($link-color, 25%); color: lighten($theme-color, 25%);
text-decoration: none; text-decoration: none;
} }
} }
@ -159,3 +159,48 @@ footer.sticky-bottom {
padding-bottom: 40px; padding-bottom: 40px;
font-size: 0.9rem; font-size: 0.9rem;
} }
// Blog
.header-bar {
border-bottom: 1px solid $grey-color-light;
text-align: center;
padding-top: 2rem;
padding-bottom: 5rem;
h1 {
color: $theme-color;
font-size: 5rem;
}
}
.post-list {
margin: 0;
margin-bottom: 40px;
padding: 0;
li {
border-bottom: 1px solid $grey-color-light;
list-style: none;
padding-top: 2rem;
padding-bottom: 2rem;
.post-meta {
color: $grey-color;
font-size: 0.875rem;
margin-bottom: 0;
}
a {
color: black;
text-decoration: none;
&:hover {
color: $theme-color;
}
}
}
}
.pagination .page-item.active .page-link {
background-color: $theme-color;
&:hover {
background-color: $theme-color;
}
}

View File

@ -1,5 +1,7 @@
--- ---
layout: default layout: default
pagination:
enabled: true
--- ---
<div class="post"> <div class="post">
@ -13,7 +15,7 @@ layout: default
<ul class="post-list"> <ul class="post-list">
{% for post in paginator.posts %} {% for post in paginator.posts %}
<li> <li>
<h2><a class="post-title" href="{{ post.url | prepend: site.baseurl }}">{{ post.title }}</a></h2> <h3><a class="post-title" href="{{ post.url | prepend: site.baseurl }}">{{ post.title }}</a></h3>
<p class="post-meta">{{ post.date | date: '%B %-d, %Y' }}</p> <p class="post-meta">{{ post.date | date: '%B %-d, %Y' }}</p>
<p>{{ post.description }}</p> <p>{{ post.description }}</p>
</li> </li>