module Jekyll::Algolia::Hooks
def self.apply_all(records)
as they can be mocked in tests.
by users. Using a wrapper around it makes testing their behavior easier
This method is a simple wrapper around methods that can be overwritten
Public: Apply the before_indexing_all hook to all records.
def self.apply_all(records) before_indexing_all(records) end
def self.apply_each(record, node)
record - The hash of the record to be pushed
as they can be mocked in tests.
by users. Using a wrapper around it makes testing their behavior easier
This method is a simple wrapper around methods that can be overwritten
Public: Apply the before_indexing_each hook to the record.
def self.apply_each(record, node) before_indexing_each(record, node) end
def self.before_indexing_all(records)
interface than `hook_before_indexing_each` when knowing the full context
Users can modify the full list from here. It might provide an easier
records - The list of all records to be indexed
indexing them
Public: Custom method to be run on the list of all records before
def self.before_indexing_all(records) records end
def self.before_indexing_each(record, _node)
information from the HTML node.
be used to remove keys that should not be indexed, or access more
Users can modify the record (adding/editing/removing keys) here. It can
node - The Nokogiri node of the element
record - The hash of the record to be pushed
Public: Custom method to be run on the record before indexing it
def self.before_indexing_each(record, _node) record end
def self.should_be_excluded?(_filepath)
but a custom hook like this one can allow more fine-grained
not. Basic exclusion can be done through the `files_to_exclude` option,
This hook allow users to define if a specific file should be indexed or
filepath - The path to the file, before transformation
Public: Check if the file should be indexed or not
def self.should_be_excluded?(_filepath) false end