module Jekyll::Algolia
def self.init(config = {})
The gist of the plugin works by instanciating a Jekyll site,
options passed on the command line)
config - A hash of Jekyll config option (merge of _config.yml options and
Public: Init the Algolia module
def self.init(config = {}) # Monkey patch Jekyll and external plugins load_overwrites config = Configurator.init(config).config @site = Jekyll::Algolia::Site.new(config) exit 1 unless Configurator.assert_valid_credentials Configurator.warn_of_deprecated_options if Configurator.dry_run? Logger.log('W:==== THIS IS A DRY RUN ====') Logger.log('W: - No records will be pushed to your index') Logger.log('W: - No settings will be updated on your index') end self end
def self.load_overwrites
Note: This is only loaded when running `jekyll algolia` so should not have
with our plugin
Public: Monkey patch Jekyll and external plugins so they don't interfere
def self.load_overwrites require 'jekyll/algolia/overwrites/githubpages-configuration' require 'jekyll/algolia/overwrites/jekyll-algolia-site' require 'jekyll/algolia/overwrites/jekyll-document' require 'jekyll/algolia/overwrites/jekyll-tags-link' # Register our own tags to overwrite the default tags Liquid::Template.register_tag('link', JekyllAlgoliaLink) end
def self.run
Note: The internal list of files to be processed will only be created when
instead.
build` except that our monkey patched `write` method will be called
Actually "process" the site, which will acts just like a regular `jekyll
Public: Run the main Algolia module
def self.run Logger.log('I:Processing site...') @site.process end
def self.site
Public: Get access to the Jekyll site
def self.site @site end