summaryrefslogtreecommitdiff
path: root/app/controllers/rss_controller.rb
diff options
context:
space:
mode:
authorerdgeist <erdgeist@erdgeist.org>2026-06-27 23:19:22 +0200
committererdgeist <erdgeist@erdgeist.org>2026-06-27 23:19:22 +0200
commitb94de9fe8c30210469953bbd9880e9cbcc7a3ef5 (patch)
tree1cc64d91634bf197fe12fa1c675ab0c92c1877a5 /app/controllers/rss_controller.rb
parent9a19a0494ef51cdac9a78e24d517ca48ba44c453 (diff)
rss: add per-tag Atom feed at /rss/tags/:tag/updates.xml
- rss#tag_updates action: filters Page.heads by tag name, default locale, 20 items, same caching as updates feed - tag_updates.xml.builder: Atom feed with CGI.escapeHTML on title and summary, consistent with updates.xml.builder - tags/show.html.erb: add subscription link above article list - routes: two routes per existing pattern (format-less + .:format constrained to /xml/)
Diffstat (limited to 'app/controllers/rss_controller.rb')
-rw-r--r--app/controllers/rss_controller.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/app/controllers/rss_controller.rb b/app/controllers/rss_controller.rb
index 4b47218..489a732 100644
--- a/app/controllers/rss_controller.rb
+++ b/app/controllers/rss_controller.rb
@@ -22,6 +22,24 @@ class RssController < ApplicationController
22 end 22 end
23 end 23 end
24 24
25 def tag_updates
26 expires_in 31.minutes, :public => true
27
28 I18n.locale = I18n.default_locale
29 @tag = params[:tag]
30 @items = Page.heads
31 .joins("JOIN taggings ON taggings.taggable_id = pages.id
32 AND taggings.taggable_type = 'Page'
33 AND taggings.context = 'tags'")
34 .joins("JOIN tags ON tags.id = taggings.tag_id")
35 .where("LOWER(tags.name) = ?", @tag.downcase)
36 .order("published_at DESC").limit(20)
37
38 respond_to do |format|
39 format.xml {}
40 end
41 end
42
25 def recent_changes 43 def recent_changes
26 @items = Page.where( 44 @items = Page.where(
27 "updated_at < ? AND updated_at > ?", Time.now, Time.now - 14.days 45 "updated_at < ? AND updated_at > ?", Time.now, Time.now - 14.days