Skip to content
This repository has been archived by the owner on Sep 25, 2024. It is now read-only.

Commit

Permalink
Merge pull request #298 from cloud-gov/fix-pagination-cache-297
Browse files Browse the repository at this point in the history
fix: Update paginate plugin to fix cache errors
  • Loading branch information
apburnes authored Jan 26, 2023
2 parents bf641dc + 440d53e commit 8adeca4
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions _plugins/paginate-patch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,15 @@ module PaginateV2::Generator
# Source issue: https://github.com/sverrirs/jekyll-paginate-v2/issues/209
#

## Updated from PR https://github.com/sverrirs/jekyll-paginate-v2/blob/01d7bfbe9a88f28c05c144d52c0df5d75f65a32a/lib/jekyll-paginate-v2/generator/paginationPage.rb

class PaginationPage < Page
def initialize(page_to_copy, cur_page_nr, total_pages, index_pageandext)
@site = page_to_copy.site
@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

Expand All @@ -36,12 +39,6 @@ def initialize(page_to_copy, cur_page_nr, total_pages, index_pageandext)
# Store the current page and total page numbers in the pagination_info construct
self.data['pagination_info'] = {"curr_page" => cur_page_nr, 'total_pages' => total_pages }

# Retain the extention so the page exists in site.html_pages
self.ext = page_to_copy.ext

# Map the first page back to the source file path, to play nice with other plugins
self.data['path'] = page_to_copy.path if cur_page_nr == 1

# Perform some validation that is also performed in Jekyll::Page
validate_data! page_to_copy.path
validate_permalink! page_to_copy.path
Expand All @@ -51,6 +48,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
Expand Down

0 comments on commit 8adeca4

Please sign in to comment.