|
@@ -4,6 +4,15 @@ require 'csv' |
|
|
require 'json' |
|
|
require 'json' |
|
|
require 'rss' |
|
|
require 'rss' |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ENV['KIOSKS_SITEURL'] |
|
|
|
|
|
SITEURL = ENV['KIOSKS_SITEURL'] |
|
|
|
|
|
else |
|
|
|
|
|
puts "KIOSKS_SITEURL environment variable must be set to the base URL of the site without a trailing slash" |
|
|
|
|
|
puts "eg https://kiosks.adrianshort.org" |
|
|
|
|
|
exit 1 |
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
class Site |
|
|
class Site |
|
|
def self.generate |
|
|
def self.generate |
|
|
# Home page |
|
|
# Home page |
|
@@ -74,15 +83,26 @@ class Site |
|
|
feed = RSS::Maker.make("2.0") do |maker| |
|
|
feed = RSS::Maker.make("2.0") do |maker| |
|
|
maker.channel.title = "InLinkUK kiosks media coverage" |
|
|
maker.channel.title = "InLinkUK kiosks media coverage" |
|
|
maker.channel.description = "News and views about Google's UK street kiosk network." |
|
|
maker.channel.description = "News and views about Google's UK street kiosk network." |
|
|
maker.channel.link = "https://kiosks.adrianshort.org/media/" |
|
|
|
|
|
|
|
|
maker.channel.link = "#{SITEURL}/media/" |
|
|
maker.channel.updated = Time.now.to_s |
|
|
maker.channel.updated = Time.now.to_s |
|
|
|
|
|
|
|
|
stories.each do |story| |
|
|
stories.each do |story| |
|
|
maker.items.new_item do |item| |
|
|
maker.items.new_item do |item| |
|
|
item.link = story['url'] |
|
|
item.link = story['url'] |
|
|
item.title = "%s: %s" % [ story['publication'], story['title'] ] |
|
|
item.title = "%s: %s" % [ story['publication'], story['title'] ] |
|
|
item.updated = story['publish_date'] |
|
|
item.updated = story['publish_date'] |
|
|
|
|
|
|
|
|
|
|
|
if story['authorities'] |
|
|
|
|
|
links = [] |
|
|
|
|
|
story['authorities'].split('|').each do |auth| |
|
|
|
|
|
auth.strip! |
|
|
|
|
|
links << "<a href=%s>%s</a>" % [ SITEURL + authority_url(auth), auth ] |
|
|
|
|
|
end |
|
|
|
|
|
item.description = links.join(', ') |
|
|
|
|
|
end |
|
|
end |
|
|
end |
|
|
end |
|
|
end |
|
|
|
|
|
|
|
|
end |
|
|
end |
|
|
Petrify.file('media', 'index.xml', feed) |
|
|
Petrify.file('media', 'index.xml', feed) |
|
|
|
|
|
|
|
|