class Jekyll::JekyllRobots

Public Instance Methods

destination_path(file = "robots.txt") click to toggle source

Destination for robots.txt file within the site source directory

# File lib/jekyll/jekyll-robotstxt.rb, line 22
def destination_path(file = "robots.txt")
  @site.in_dest_dir(file)
end
file_exists?(file_path) click to toggle source

Checks if a file already exists in the site source

# File lib/jekyll/jekyll-robotstxt.rb, line 33
def file_exists?(file_path)
  if @site.respond_to?(:in_source_dir)
    File.exist? @site.in_source_dir(file_path)
  else
    File.exist? Jekyll.sanitized_path(@site.source, file_path)
  end
end
generate(site) click to toggle source

Main plugin action, called by Jekyll-core

# File lib/jekyll/jekyll-robotstxt.rb, line 11
def generate(site)
  @site = site
  @site.pages << robots
end
robots() click to toggle source
# File lib/jekyll/jekyll-robotstxt.rb, line 26
def robots
  robots = PageWithoutAFile.new(@site, __dir__, "", "robots.txt")
  robots.data["layout"] = nil
  robots
end
source_path(file = "robots.txt") click to toggle source

Path to robots.txt template file

# File lib/jekyll/jekyll-robotstxt.rb, line 17
def source_path(file = "robots.txt")
  File.expand_path "../#{file}", __dir__
end