From 01d7bfbe9a88f28c05c144d52c0df5d75f65a32a Mon Sep 17 00:00:00 2001 From: MoHKale Date: Tue, 17 Mar 2020 20:23:20 +0000 Subject: [PATCH] paginationPage.rb: fix jekyll4 cache mismatch errors Jekyll 4.0 introduced a new caching mechanism to the LiquidRenderer class. This remembers the paths of any files passed to convert and the rendered output. The cache is reset between repeat invocations of `Site.process' it's really only to prevent needing to re render templates or includes. The cache works by remembering the file name of any files being rendered, returning the cached value on demand should jekyll try to render a file with the same path (from the src directory) multiple times. The issue here is that Jekyll-Paginate-V2 sets the name of all `Jekyll::PaginateV2::Generator::PaginationPage` instances to index.html. Meaning every pagination page gets rendered to the result of the first paginated page. This patch simply assigns some fields the Page instance, such that it appears to have the same file name as the file to which it's written to (which should guarantee it's uniqueness and prevent liquid cache mismatches). --- lib/jekyll-paginate-v2/generator/paginationPage.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/jekyll-paginate-v2/generator/paginationPage.rb b/lib/jekyll-paginate-v2/generator/paginationPage.rb index 494cda9..ef9164f 100644 --- a/lib/jekyll-paginate-v2/generator/paginationPage.rb +++ b/lib/jekyll-paginate-v2/generator/paginationPage.rb @@ -14,6 +14,7 @@ def initialize(page_to_copy, cur_page_nr, total_pages, index_pageandext) @base = '' @url = '' @name = index_pageandext.nil? ? 'index.html' : index_pageandext + @path = page_to_copy.path self.process(@name) # Creates the basename and ext member values @@ -41,6 +42,8 @@ def initialize(page_to_copy, cur_page_nr, total_pages, index_pageandext) end def set_url(url_value) + @path = url_value.delete_prefix '/' + @dir = File.dirname(@path) @url = url_value end end # class PaginationPage