From b94de9fe8c30210469953bbd9880e9cbcc7a3ef5 Mon Sep 17 00:00:00 2001 From: erdgeist Date: Sat, 27 Jun 2026 23:19:22 +0200 Subject: 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/) --- app/controllers/rss_controller.rb | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'app/controllers/rss_controller.rb') 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 end end + def tag_updates + expires_in 31.minutes, :public => true + + I18n.locale = I18n.default_locale + @tag = params[:tag] + @items = Page.heads + .joins("JOIN taggings ON taggings.taggable_id = pages.id + AND taggings.taggable_type = 'Page' + AND taggings.context = 'tags'") + .joins("JOIN tags ON tags.id = taggings.tag_id") + .where("LOWER(tags.name) = ?", @tag.downcase) + .order("published_at DESC").limit(20) + + respond_to do |format| + format.xml {} + end + end + def recent_changes @items = Page.where( "updated_at < ? AND updated_at > ?", Time.now, Time.now - 14.days -- cgit v1.3