Commit ea8ba7ec authored by Jacek Lebioda's avatar Jacek Lebioda
Browse files

Pagination should be working

parent 6c4002e3
......@@ -45,7 +45,7 @@ Save, and commit the file. Every time you commit and push to the repository, the
### How to add new pages to the website?
Create a new `.md` file inside the project's directory.
For example, you can copy `index.md` file (and you can refer to it's contents as to a valid page).
For example, you can copy `index.md` file (and you can refer to its contents as to a valid page).
It should contain the following header:
......@@ -68,14 +68,15 @@ Create a folder in `assets/banners` directory, with `banner.svg`, `logos.svg` an
In case `logos.svg` file is wide, change `logo: small` to `logo: big` in `_config.yml`.
### Enabling and configuring pagination
The template includes `jekyll-paginate-v2` plugin by default.
To use it, configure the pagination following instructions from the next paragraph, specify `paginated_index` as the post layout for the index page (it will contain the paginator), create a directory called `_posts` in the project root directory and fill it with posts.
The template includes `jekyll-paginate-v2` plugin by default, but it's turned off.
To use it, configure the pagination following instructions from the next paragraph, go to `pagination.md` file and change `enabled: false` to `enabled: true`, and `published: false` to `published: true`. Later, create a directory called `_posts` in the project root directory and fill it with posts.
You may also need to disable showing `index.md`, by setting `published: false` in its contents.
There are two sections in `_config.yml`, that refer to pagination: first, ` - jekyll-paginate-v2` line in plugins section, and then the configuration dictionary:
```
pagination:
enabled: true # Change to false to disable pagination
enabled: true # Note, that setting it to disabled does not disable it completely, as it has to be also set to false in `pagination.md` file
title: ':title - page :num of :max' # Customize the text
per_page: 8 # How many posts should be displayed on one page
permalink: '/page/:num/' # The URL to the index of pagination
......@@ -87,7 +88,7 @@ pagination:
after: 2 # Show 2 after the current one, e.g. `... CURRENT 6 7 >`
```
To disable it completely, set `enabled` to `false`, remove the aforementioned sections from the configuration, and `gem "jekyll-paginate-v2", "~> 1.7"` from `Gemfile` (from the project root).
To disable it completely, set `enabled` to `false`, remove the aforementioned sections from the configuration, and `gem "jekyll-paginate-v2", "~> 1.7"` from `Gemfile` (from the project's root), and remove `pagination.md` file from project's root directory.
Refer to its [documentation](https://github.com/sverrirs/jekyll-paginate-v2/blob/master/README-GENERATOR.md) for more detailed instructions.
### Enabling Google Analytics
......
......@@ -15,7 +15,8 @@
# in the templates via {{ site.myvariable }}.
title: LCSB Jekyll default theme
email: lcsb-sysadmins@uni.lu
banner: frozen # When you have custom images, change this setting's value to the name of the folder containing them
banner: default # When you have custom images, change this setting's value to the name of the folder containing them
# Refer to assets/banners/default or assets/banners/frozen
logo: small # Change to "big" (without quotas) in case of having broad logo
date: "2018"
description: >- # this means to ignore newlines until "baseurl:"
......@@ -35,7 +36,7 @@ plugins:
# Pagination Settings
pagination:
enabled: true
enabled: false
title: ':title - page :num of :max'
per_page: 8
permalink: '/page/:num/'
......
......@@ -5,7 +5,10 @@ layout: default
<style>
h2 {margin-bottom: 3px;}
ul.pager { text-align: center; list-style: none; }
ul.pager li {display: inline;border: 1px solid black; padding: 10px; margin: 5px;}
ul.pager li {display: inline; padding: 10px; margin: 5px; border: solid 1px #e3e3e3; }
ul.pager li:hover { text-decoration: none; border: solid 1px #929292; }
ul.pager a:hover { text-decoration: none; }
ul.pager li.pager-active { background-color: white; border: solid 1px #929292; }
</style>
<div class="home">
......@@ -19,7 +22,7 @@ layout: default
{% comment %}
Here is the main paginator logic called.
All calls to site.posts should be replaced by paginator.posts
{% end comment %}
{% endcomment %}
{% for post in paginator.posts %}
<li>
......@@ -39,20 +42,20 @@ layout: default
Some legacy code (might be useful):
{% if paginator.total_pages > 1 %}
<ul class="pager">
{% if paginator.previous_page %}
<li class="previous">
<a href="{{ paginator.previous_page_path | prepend: site.baseurl | replace: '//', '/' }}">&larr; Newer Posts</a>
</li>
<ul class="pager">
{% if paginator.previous_page %}
<li class="previous">
<a href="{{ paginator.previous_page_path | prepend: site.baseurl | replace: '//', '/' }}">&larr; Newer Posts</a>
</li>
{% endif %}
{% if paginator.next_page %}
<li class="next">
<a href="{{ paginator.next_page_path | prepend: site.baseurl | replace: '//', '/' }}">Older Posts &rarr;</a>
</li>
{% endif %}
</ul>
{% endif %}
{% if paginator.next_page %}
<li class="next">
<a href="{{ paginator.next_page_path | prepend: site.baseurl | replace: '//', '/' }}">Older Posts &rarr;</a>
</li>
{% endif %}
</ul>
{% endif %}
{% end comment %}
{% endcomment %}
{% if paginator.page_trail %}
......
---
# You don't need to edit this file, it's empty on purpose.
# Edit theme's home layout instead if you wanna make some changes
# See: https://jekyllrb.com/docs/themes/#overriding-theme-defaults
title: index
layout: paginated_index
published: false
pagination:
enabled: false
---
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment