module Jekyll::Algolia::FileBrowser

def self.pagination_page?(file)

We don't want to index those
`jekyll-paginate` automatically creates pages to paginate through posts.

file - The Jekyll file

Public: Check if the page is a pagination page
def self.pagination_page?(file)
  # paginate_path contains a special `:num` part that is the page number
  # We convert that to a regexp
  paginate_path = Configurator.get('paginate_path')
  paginate_path_as_regexp = paginate_path.gsub(':num', '([0-9]*)')
  regexp = %r{#{paginate_path_as_regexp}/index\.html$}
  # Make sure all file paths start with a / for comparison
  filepath = file.path
  filepath = "/#{filepath}" unless filepath[0] == '/'
  Utils.match?(filepath, regexp)
end