class Jekyll::Algolia::Site

Algolia instead of writing files to disk.
create JSON records out of rendered documents and push those records to
A Jekyll::Site subclass that overrides #write from the parent class to

def cleanup; end

files from destination
We make the cleanup method a noop, otherwise it will remove excluded
def cleanup; end

def write

def write
  records = []
  files = []
  Logger.log('I:Extracting records...')
  each_site_file do |file|
    path = FileBrowser.relative_path(file)
    # Skip files that should not be indexed
    is_indexable = FileBrowser.indexable?(file)
    unless is_indexable
      Logger.verbose("W:Skipping #{path}")
      next
    end
    Logger.verbose("I:Extracting records from #{path}")
    file_records = Extractor.run(file)
    files << file
    records += file_records
  end
  # Applying the user hook on the whole list of records
  records = Hooks.apply_all(records)
  # Adding a unique objectID to each record
  records.map! do |record|
    Extractor.add_unique_object_id(record)
  end
  Logger.verbose("I:Found #{files.length} files")
  Indexer.run(records)
end