Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions lib/jekyll-paginate-v2/generator/paginationPage.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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 '/'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution: String#delete_prefix was added only in Ruby 2.5. Therefore, this will break on older Ruby versions.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this seem better to you?

if path[0] == '/'
  path[1..]
end

@dir = File.dirname(@path)
@url = url_value
end
end # class PaginationPage
Expand Down