Browse Source

Add media RSS feed

main
Adrian Short 5 years ago
parent
commit
b72f3b3a9c
2 changed files with 20 additions and 0 deletions
  1. +16
    -0
      lib/site.rb
  2. +4
    -0
      views/media.haml

+ 16
- 0
lib/site.rb View File

@@ -2,6 +2,7 @@ require 'scraperwiki'
require 'petrify'
require 'csv'
require 'json'
require 'rss'

class Site
def self.generate
@@ -70,6 +71,21 @@ class Site
stories = CSV.read('media.csv', :headers => true )
Petrify.page('media', 'media', { stories: stories, title: "Media" })

feed = RSS::Maker.make("2.0") do |maker|
maker.channel.title = "InLinkUK kiosks media coverage"
maker.channel.description = "News and views about Google's UK street kiosk network."
maker.channel.link = "https://kiosks.adrianshort.org/media/"
maker.channel.updated = Time.now.to_s
stories.each do |story|
maker.items.new_item do |item|
item.link = story['url']
item.title = "%s: %s" % [ story['publication'], story['title'] ]
item.updated = story['publish_date']
end
end
end
Petrify.file('media', 'index.xml', feed)
# Authority pages
auths = ScraperWiki.select("distinct(authority_name) as authority_name
from applications")


+ 4
- 0
views/media.haml View File

@@ -1,5 +1,9 @@
%h1 Media

%p
%a{ :href => 'index.xml' }
RSS feed

%p
%a.button{ :href => 'https://github.com/adrianshort/kiosks-campaign/issues/1' }
Add more media here


Loading…
Cancel
Save