module Jekyll::Algolia::FileBrowser
def self.date(file)
Pages and other collection items can only have a date set in
Posts have their date coming from the filepath, or the front-matter.
file - The Jekyll file
Public: Returns a timestamp of the file date
def self.date(file) # Collections get their date from .date, while pages read it from .data. # Jekyll by default will set the date of collection to the current date, # but we overwrote this. date = if file.respond_to?(:date) file.date else file.data['date'] end return nil if date.nil? date.to_time.to_i end