Browse Source

Add RSS media feeds for individual authorities

main
Adrian Short 4 years ago
parent
commit
b8e3a598e3
2 changed files with 39 additions and 3 deletions
  1. +26
    -1
      lib/site.rb
  2. +13
    -2
      views/authority.haml

+ 26
- 1
lib/site.rb View File

@@ -102,7 +102,6 @@ class Site
end
end
end

end
Petrify.file('media', 'index.xml', feed)
@@ -131,6 +130,32 @@ class Site
Petrify.page(path, 'authority', \
{ apps: apps, auth: auth, summary: summary, stories: this_stories, title: auth['authority_name'] })
Petrify.csv(path, slug(auth['authority_name']), apps)
# RSS feed for this authority's media stories
feed = RSS::Maker.make("2.0") do |maker|
maker.channel.title = "#{auth['authority_name']} InLinkUK kiosks media coverage"
maker.channel.description = "News and views about Google's UK street kiosk network in #{auth['authority_name']}."
maker.channel.link = "#{SITEURL}#{authority_url(auth['authority_name'])}"
maker.channel.updated = Time.now.to_s

this_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']
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
Petrify.file(path, 'media.xml', feed)
end
end
end

+ 13
- 2
views/authority.haml View File

@@ -21,10 +21,19 @@
%td= cleanup(row['appeal_decision'])
%td.right= row['qty']

- if stories.size > 0

%h2 Media
%h2 Media

%p
%a{ :href => 'media.xml' }
RSS feed for InLinkUK media stories in
= auth['authority_name']

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

- if stories.size > 0
%table
- stories.each do |item|
%tr
@@ -33,6 +42,8 @@
%td
%a{ :href => item['url'] }<
= item['title']
- else
%p No media stories.

%h2 Applications



Loading…
Cancel
Save