mirror of
https://github.com/CodeforLeipzig/stadtratmonitor.git
synced 2024-12-22 23:53:15 +01:00
add creator and categories to RSS feed, format pubData correctly
This commit is contained in:
parent
796643c1d9
commit
ea83cd6f00
1 changed files with 26 additions and 3 deletions
|
@ -1,5 +1,7 @@
|
||||||
|
require 'date'
|
||||||
|
|
||||||
xml.instruct! :xml, :version => "1.0"
|
xml.instruct! :xml, :version => "1.0"
|
||||||
xml.rss :version => "2.0" do
|
xml.rss :version => "2.0", "xmlns:dc" => "http://purl.org/dc/elements/1.1/" do
|
||||||
xml.channel do
|
xml.channel do
|
||||||
xml.title "Search results"
|
xml.title "Search results"
|
||||||
xml.description "Papers matching search criteria"
|
xml.description "Papers matching search criteria"
|
||||||
|
@ -8,8 +10,29 @@ xml.rss :version => "2.0" do
|
||||||
@papers.each do |doc|
|
@papers.each do |doc|
|
||||||
xml.item do
|
xml.item do
|
||||||
xml.title doc.name
|
xml.title doc.name
|
||||||
xml.description truncate(doc.content, length: 768)
|
if !doc.content.blank?
|
||||||
xml.pubDate doc.published_at.to_date.to_s(:rfc822)
|
xml.description do
|
||||||
|
xml.cdata! truncate(doc.content, length: 768)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if !doc.published_at.blank?
|
||||||
|
xml.pubDate DateTime.parse(doc.published_at).utc.strftime("%a, %d %b %Y %H:%M:%S %z")
|
||||||
|
end
|
||||||
|
doc.originator.each do |originator|
|
||||||
|
xml.dc :creator do
|
||||||
|
xml.cdata! originator
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if !doc.paper_type.blank?
|
||||||
|
xml.category do
|
||||||
|
xml.cdata! doc.paper_type
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if !doc.resolution.blank?
|
||||||
|
xml.category do
|
||||||
|
xml.cdata! doc.resolution
|
||||||
|
end
|
||||||
|
end
|
||||||
xml.link doc.url
|
xml.link doc.url
|
||||||
xml.guid doc.url
|
xml.guid doc.url
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue