Add extra question to ensure that the index.html file is in thepagination path's directory
This commit is contained in:
parent
2d0e65b5f7
commit
050e982006
|
@ -69,9 +69,19 @@ module Jekyll
|
||||||
#
|
#
|
||||||
# Returns true if pagination is enabled, false otherwise.
|
# Returns true if pagination is enabled, false otherwise.
|
||||||
def self.pagination_enabled?(config, page)
|
def self.pagination_enabled?(config, page)
|
||||||
page.name == 'index.html' &&
|
!config['paginate'].nil? &&
|
||||||
!config['paginate'].nil? &&
|
page.name == 'index.html' &&
|
||||||
File.dirname(config['paginate_path']) == page.dir
|
subdirectories_identical(config['paginate_path'], page.dir)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Determine if the subdirectories of the two paths are the same relative to source
|
||||||
|
#
|
||||||
|
# paginate_path - the paginate_path configuration setting
|
||||||
|
# page_dir - the directory of the Jekyll::Page
|
||||||
|
#
|
||||||
|
# Returns whether the subdirectories are the same relative to source
|
||||||
|
def self.subdirectories_identical(paginate_path, page_dir)
|
||||||
|
File.dirname(paginate_path).gsub(/\A\./, '') == page_dir.gsub(/\/\z/, '')
|
||||||
end
|
end
|
||||||
|
|
||||||
# Static: Return the pagination path of the page
|
# Static: Return the pagination path of the page
|
||||||
|
|
Loading…
Reference in New Issue