Fix RSS feed

This commit is contained in:
2024-05-05 20:16:26 +10:00
parent 4c5246374b
commit 0b79872cbe
6 changed files with 72 additions and 56 deletions

View File

@@ -64,4 +64,4 @@
</body> </body>
</html> </html>
</xsl:template> </xsl:template>
</xsl:stylesheet> </xsl:stylesheet>

View File

@@ -81,7 +81,11 @@ module Admin
def display_title def display_title
title = name title = name
"#{prefix_emoji} #{title}" if prefix_emoji
return "#{prefix_emoji} #{title}"
else
return title
end
end end
def display_published_at def display_published_at

View File

@@ -85,7 +85,11 @@ module Main
def display_title def display_title
title = name title = name
"#{prefix_emoji} #{title}" if prefix_emoji
return "#{prefix_emoji} #{title}"
else
return title
end
end end
def display_published_at def display_published_at

View File

@@ -1,35 +1,37 @@
xml.instruct! "xml-stylesheet", {href: "/assets/full_style.xslt", type: "text/xsl"} xml.instruct! "xml-stylesheet", {href: "/assets/full_style.xslt", type: "text/xsl"}
xml.channel do |channel| xml.rss do |rss|
channel.title "Daniel Nitsikopoulos" rss.channel do |channel|
channel.description "The personal blog of Daniel Nitsikopoulos, software engineer from Canberra, ACT" channel.title "Daniel Nitsikopoulos"
channel.link "https://dnitza.com" channel.description "The personal blog of Daniel Nitsikopoulos, software engineer from Canberra, ACT"
channel.name "dnitza.com" channel.link "https://dnitza.com"
channel.lastBuildDate Time.now.rfc2822 channel.name "dnitza.com"
channel.pubDate Time.now.rfc2822 channel.lastBuildDate Time.now.rfc2822
channel.ttl 1800 channel.pubDate Time.now.rfc2822
channel.ttl 1800
channel.alternate_feed do |item| channel.alternate_feed do |item|
item.link "/feeds/rss" item.link "/feeds/rss"
item.title "Main feed (this feed)" item.title "Main feed (this feed)"
item.description "Containing longer text posts and bookmarks" item.description "Containing longer text posts and bookmarks"
end end
channel.alternate_feed do |item| channel.alternate_feed do |item|
item.link "/feeds/statuses_rss" item.link "/feeds/statuses_rss"
item.title "Statuses / Microblog" item.title "Statuses / Microblog"
item.description "Only shorter posts and photo posts, usually also appearing on Mastodon" item.description "Only shorter posts and photo posts, usually also appearing on Mastodon"
end end
posts.each do |post| posts.each do |post|
channel.item do |item| channel.item do |item|
item.title post.display_title item.title post.display_title
item.description do |desc| item.description do |desc|
desc.cdata! post.feed_content desc.cdata! post.feed_content
end
item.link(post.permalink)
item.guid(post.slug, isPermaLink: true)
item.pubDate post.machine_published_at
end end
item.link(post.permalink)
item.guid(post.slug, isPermaLink: true)
item.pubDate post.machine_published_at
end end
end end
end end

View File

@@ -1,35 +1,37 @@
xml.instruct! "xml-stylesheet", {href: "/assets/style.xslt", type: "text/xsl"} xml.instruct! "xml-stylesheet", {href: "/assets/style.xslt", type: "text/xsl"}
xml.channel do |channel| xml.rss do |rss|
channel.title "Daniel Nitsikopoulos" rss.channel do |channel|
channel.description "The personal blog of Daniel Nitsikopoulos, software engineer from Canberra, ACT" channel.title "Daniel Nitsikopoulos"
channel.link "https://dnitza.com" channel.description "The personal blog of Daniel Nitsikopoulos, software engineer from Canberra, ACT"
channel.name "dnitza.com" channel.link "https://dnitza.com"
channel.lastBuildDate Time.now.rfc2822 channel.name "dnitza.com"
channel.pubDate Time.now.rfc2822 channel.lastBuildDate Time.now.rfc2822
channel.ttl 1800 channel.pubDate Time.now.rfc2822
channel.ttl 1800
channel.alternate_feed do |item| channel.alternate_feed do |item|
item.link "/feeds/rss" item.link "/feeds/rss"
item.title "Main feed" item.title "Main feed"
item.description "Containing longer text posts and bookmarks" item.description "Containing longer text posts and bookmarks"
end end
channel.alternate_feed do |item| channel.alternate_feed do |item|
item.link "/feeds/statuses_rss" item.link "/feeds/statuses_rss"
item.title "Statuses / Microblog (this feed)" item.title "Statuses / Microblog (this feed)"
item.description "Only shorter posts and photo posts, usually also appearing on Mastodon" item.description "Only shorter posts and photo posts, usually also appearing on Mastodon"
end end
posts.each do |post| posts.each do |post|
channel.item do |item| channel.item do |item|
item.title post.raw_content item.title post.raw_content
item.description do |desc| item.description do |desc|
desc.cdata! post.feed_content desc.cdata! post.feed_content
end
item.link(post.permalink)
item.guid(post.slug, isPermaLink: true)
item.pubDate post.machine_published_at
end end
item.link(post.permalink)
item.guid(post.slug, isPermaLink: true)
item.pubDate post.machine_published_at
end end
end end
end end

View File

@@ -50,7 +50,11 @@ module Micropub
def display_title def display_title
title = name title = name
"#{prefix_emoji} #{title}" if prefix_emoji
return "#{prefix_emoji} #{title}"
else
return title
end
end end
def display_published_at def display_published_at