Sha256: 0eb8366bcc587eba5c1a18b4363d5fb2d6ba6da769f950e88e8255c2ec14f1be
Contents?: true
Size: 809 Bytes
Versions: 3
Compression:
Stored size: 809 Bytes
Contents
%w{ rss/maker murlsh }.each { |m| require m } module Murlsh # Regenerate RSS feed after a new url has been added. class AddPost50UpdateRss < Plugin Hook = 'add_post' def self.run(config) output_file = 'rss.xml' feed = RSS::Maker.make('2.0') do |f| f.channel.title = f.channel.description = config.fetch('page_title', '') f.channel.link = URI.join(config.fetch('root_url'), output_file) f.items.do_sort = true Murlsh::Url.all(:order => 'id DESC', :limit => config.fetch('num_posts_feed', 25)).each do |mu| i = f.items.new_item i.title = mu.title_stripped i.link = mu.url i.date = mu.time end end Murlsh::openlock(output_file, 'w') { |f| f.write(feed) } end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
murlsh-0.8.1 | plugins/add_post_50_update_rss.rb |
murlsh-0.8.0 | plugins/add_post_50_update_rss.rb |
murlsh-0.7.0 | plugins/add_post_50_update_rss.rb |