module Jekyll::Algolia::FileBrowser

def self.type(file)

Posts are a custom kind of Documents
Elements from a collection are called Documents
Pages are simple html and markdown documents in the tree

file - The Jekyll file

Public: Get the type of the document (page, post, collection, etc)
def self.type(file)
  type = file.class.name.split('::')[-1].downcase
  type = 'post' if type == 'document' && file.collection.label == 'posts'
  type
end