module Jekyll::Algolia::FileBrowser

def self.collection(file)

part of a collection
are purposefully excluded from it as well even if they are technically
Only collection documents can have a collection name. Pages don't. Posts

file - The Jekyll file

Public: Returns the name of the collection
def self.collection(file)
  return nil unless file.respond_to?(:collection)
  collection_name = file.collection.label
  # Posts are a special kind of collection, but it's an implementation
  # detail from my POV, so I'll exclude them
  return nil if collection_name == 'posts'
  collection_name
end