diff --git a/app/actions/feeds/rss.rb b/app/actions/feeds/rss.rb index 79fbe95..30fe4b9 100644 --- a/app/actions/feeds/rss.rb +++ b/app/actions/feeds/rss.rb @@ -5,7 +5,7 @@ module Adamantium include Deps["views.feeds.rss"] def handle(req, res) - res.content_type = "application/rss+xml" + res.content_type = "text/xml; charset=utf-8" res.render rss, format: :xml end end diff --git a/app/templates/feeds/rss.xml.builder b/app/templates/feeds/rss.xml.builder index eda69bf..d193b0e 100644 --- a/app/templates/feeds/rss.xml.builder +++ b/app/templates/feeds/rss.xml.builder @@ -1,8 +1,10 @@ -xml.instruct!(:xml, version: "2.0", encoding: "utf-8") +xml.instruct! "xml-stylesheet", {:href=>"/assets/style.xslt", :type=>"text/xsl"} xml.channel do |channel| channel.title "Daniel Nitsikopoulos" - channel.description "The RSS feed for https://dnitza.com" + channel.description "The personal blog of Daniel Nitsikopoulos, software engineer from Canberra, ACT" + channel.link "https://dnitza.com" + channel.name "dnitza.com" channel.lastBuildDate Time.now.rfc2822 channel.pubDate Time.now.rfc2822 channel.ttl 1800 @@ -13,6 +15,7 @@ xml.channel do |channel| item.description do |desc| desc.cdata! post.feed_content end + item.link(post.permalink) item.guid(post.slug, isPermaLink: true) item.pubDate post.machine_published_at end diff --git a/app/templates/layouts/app.xml.builder b/app/templates/layouts/app.xml.builder index e69de29..721ca5d 100644 --- a/app/templates/layouts/app.xml.builder +++ b/app/templates/layouts/app.xml.builder @@ -0,0 +1,2 @@ +xml.instruct! + xml << yield \ No newline at end of file diff --git a/app/views/feeds/rss.rb b/app/views/feeds/rss.rb index 5f010b5..da5cb47 100644 --- a/app/views/feeds/rss.rb +++ b/app/views/feeds/rss.rb @@ -12,7 +12,7 @@ module Adamantium end end - expose :xml, decorate: false, layout: true + expose :xml, decorate: false def xml Builder::XmlMarkup.new(indent: 2) diff --git a/public/assets/style.xslt b/public/assets/style.xslt new file mode 100644 index 0000000..436e196 --- /dev/null +++ b/public/assets/style.xslt @@ -0,0 +1,53 @@ + + + + + + + <xsl:value-of select="/rss/channel/title"/> Web Feed + + + + + + +
+
+

+

+ + + + + Visit Website → + +
+

Recent Items

+ +
+

+ + + + + + +

+ + Published: + +
+
+
+ + +
+
\ No newline at end of file