From 51fdc61d1c0249398f31007dd11238a2fa84542d Mon Sep 17 00:00:00 2001 From: Alex Ibrado Date: Thu, 30 Nov 2017 18:56:40 +0800 Subject: [PATCH] Generate at least one page, issue #52 --- lib/jekyll-paginate-v2/generator/paginationModel.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/jekyll-paginate-v2/generator/paginationModel.rb b/lib/jekyll-paginate-v2/generator/paginationModel.rb index 9efbc59..183031a 100644 --- a/lib/jekyll-paginate-v2/generator/paginationModel.rb +++ b/lib/jekyll-paginate-v2/generator/paginationModel.rb @@ -267,6 +267,11 @@ def paginate(template, config, site_title, all_posts, all_tags, all_categories, indexPageExt = Utils.ensure_leading_dot(config['extension']) indexPageWithExt = indexPageName + indexPageExt + # In case there are no (visible) posts, generate the index file anyway + if total_pages == 0 + total_pages = 1 + end + # Now for each pagination page create it and configure the ranges for the collection # This .pager member is a built in thing in Jekyll and defines the paginator implementation # Simpy override to use mine