Commit 93b90382 authored by Jacek Lebioda's avatar Jacek Lebioda
Browse files

Introducing pagination

parent be979e7f
......@@ -23,6 +23,7 @@ gem 'jekyll-theme-lcsb-default', '~> 0.2.5', :git => "https://git-r3lab.uni.lu/c
# If you have any plugins, put them here!
group :jekyll_plugins do
gem "jekyll-paginate-v2", "~> 1.7"
gem "jekyll-feed", "~> 0.6"
end
......
......@@ -107,6 +107,30 @@ unless you want to contribute back to the upstream project.
* [jekyll-branched](https://gitlab.com/pages/jekyll-branched) demonstrates how you can keep your GitLab Pages site in one branch and your project's source code in another.
* The [jekyll-themes](https://gitlab.com/groups/jekyll-themes) group contains a collection of example projects you can fork (like this one) having different visual styles.
## Enabling and configuring pagination
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 # 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
limit: 0
sort_field: 'date' # How the posts should be sorted. can also be: `title` or any page attribute
sort_reverse: true
trail: # How many pages should be shown in paginator.
before: 2 # Show 2 before the current one, e.g. `< 5 6 CURRENT ...`
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'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.
## Troubleshooting
1. CSS is missing! That means two things:
......
......@@ -34,10 +34,24 @@ markdown: kramdown
theme: jekyll-theme-lcsb-default
plugins:
- jekyll-feed
- jekyll-paginate-v2
# Produces a cleaner folder structure when using categories
permalink: /:year/:month/:title.html
# Pagination Settings
pagination:
enabled: true
title: ':title - page :num of :max'
per_page: 7
permalink: '/page/:num/'
limit: 0
sort_field: 'date'
sort_reverse: true
trail:
before: 2
after: 2
# Exclude from processing.
# The following items will not be processed, by default. Create a custom list
# to override the default setting.
......
......@@ -2,6 +2,7 @@
layout: page
title: About
permalink: /about/
order: 2
---
This is the LCSB Jekyll theme. You can find out more info about customizing your Jekyll theme, as well as basic Jekyll usage documentation at [jekyllrb.com](https://jekyllrb.com/)
......
......@@ -2,6 +2,7 @@
layout: page
title: Help
permalink: /the-help/
order: 3
---
This is the `help` page.
\ No newline at end of file
......@@ -3,6 +3,8 @@
# Edit theme's home layout instead if you wanna make some changes
# See: https://jekyllrb.com/docs/themes/#overriding-theme-defaults
layout: default
title: Index
order: 1
---
This is the `default lcsb theme` for gitlab pages...
......
---
# To enable the pagination, do the following changes in this file:
# published: true
# pagination:
# enabled: true
# And inside index.md, add `published: false`
# 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
---
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