module Jekyll::Algolia::FileBrowser
def self.relative_path(file)
(pages) or as an absolute paths (posts and static assets). We make sure
Jekyll handles the .path property of some files as relative to the root
file - The Jekyll file to inspect
Public: Return the path of a Jekyll file relative to the Jekyll source
def self.relative_path(file) pathname = Pathname.new(file.path) return file.path if pathname.relative? jekyll_source = Pathname.new( File.expand_path(Configurator.get('source')) ) pathname.relative_path_from(jekyll_source).cleanpath.to_s end