today_ai_weather/app/views/rss/feed.rss.builder

25 lines
897 B
Plaintext
Raw Normal View History

# app/views/rss/feed.rss.builder
xml.instruct! :xml, version: "1.0"
xml.rss version: "2.0",
"xmlns:atom" => "http://www.w3.org/2005/Atom" do
xml.channel do
xml.title "Today AI Weather Art"
xml.description "Daily AI-generated weather art and forecasts"
xml.link root_url
xml.language "en"
xml.atom :link, href: rss_feed_url(format: :rss), rel: "self", type: "application/rss+xml"
@weather_arts.each do |art|
xml.item do
xml.title "#{art.city.full_name} Weather Art"
xml.description art.description
xml.pubDate art.created_at.to_fs(:rfc822)
xml.link city_weather_art_url(art.city, art)
xml.guid city_weather_art_url(art.city, art)
# 如果有图片,添加图片链接
xml.enclosure url: rails_blob_url(art.webp_image.processed), type: "image/jpeg" if art.image.attached?
end
end
end
end