class Jekyll::JekyllFeed
Public Instance Methods
generate(site)
click to toggle source
Main plugin action, called by Jekyll-core
# File lib/jekyll/jekyll-feed.rb, line 9 def generate(site) @site = site @site.config["time"] = Time.new unless feed_exists? @site.pages << feed_content end end
Private Instance Methods
feed_content()
click to toggle source
# File lib/jekyll/jekyll-feed.rb, line 33 def feed_content feed = PageWithoutAFile.new(@site, File.dirname(__FILE__), "", path) feed.content = File.read(source_path).gsub(/(?<!\")\s+([<{])/, '\1') feed.data["layout"] = nil feed.data["sitemap"] = false feed.output feed end
feed_exists?()
click to toggle source
Checks if a feed already exists in the site source
# File lib/jekyll/jekyll-feed.rb, line 43 def feed_exists? if @site.respond_to?(:in_source_dir) File.exist? @site.in_source_dir(path) else File.exist? Jekyll.sanitized_path(@site.source, path) end end
path()
click to toggle source
Path to feed from config, or feed.xml for default
# File lib/jekyll/jekyll-feed.rb, line 20 def path if @site.config["feed"] && @site.config["feed"]["path"] @site.config["feed"]["path"] else "feed.xml" end end
source_path()
click to toggle source
Path to feed.xml template file
# File lib/jekyll/jekyll-feed.rb, line 29 def source_path File.expand_path "../feed.xml", File.dirname(__FILE__) end