diff options
| author | erdgeist <erdgeist@erdgeist.org> | 2026-06-27 23:19:22 +0200 |
|---|---|---|
| committer | erdgeist <erdgeist@erdgeist.org> | 2026-06-27 23:19:22 +0200 |
| commit | b94de9fe8c30210469953bbd9880e9cbcc7a3ef5 (patch) | |
| tree | 1cc64d91634bf197fe12fa1c675ab0c92c1877a5 /app/views/rss | |
| parent | 9a19a0494ef51cdac9a78e24d517ca48ba44c453 (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/views/rss')
| -rw-r--r-- | app/views/rss/tag_updates.xml.builder | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/app/views/rss/tag_updates.xml.builder b/app/views/rss/tag_updates.xml.builder new file mode 100644 index 0000000..6491cfc --- /dev/null +++ b/app/views/rss/tag_updates.xml.builder | |||
| @@ -0,0 +1,27 @@ | |||
| 1 | xml.instruct! | ||
| 2 | |||
| 3 | xml.feed(:xmlns => "http://www.w3.org/2005/Atom", "xml:base" => @host) do | ||
| 4 | xml.title("Chaos Computer Club: #{@tag}") | ||
| 5 | xml.link(:href => "#{@host}/") | ||
| 6 | xml.link(:rel => "self", :href => "#{@host}/rss/tags/#{@tag}/updates.xml") | ||
| 7 | xml.updated(@items.first.published_at.xmlschema) unless @items.empty? | ||
| 8 | xml.author do | ||
| 9 | xml.name("Chaos Computer Club e. V.") | ||
| 10 | end | ||
| 11 | xml.id("#{@host}/rss/tags/#{@tag}/updates") | ||
| 12 | |||
| 13 | @items.each do |item| | ||
| 14 | xml.entry do | ||
| 15 | xml.title(CGI.escapeHTML(item.title.to_s)) | ||
| 16 | xml.link( | ||
| 17 | :href => content_url(:page_path => item.node.unique_path), | ||
| 18 | :rel => "alternate", | ||
| 19 | :type => "text/html" | ||
| 20 | ) | ||
| 21 | xml.id(content_url(:page_path => item.node.feed_id)) | ||
| 22 | xml.updated(item.updated_at.xmlschema) | ||
| 23 | xml.published(item.published_at.xmlschema) | ||
| 24 | xml.summary(CGI.escapeHTML(item.abstract.to_s)) | ||
| 25 | end | ||
| 26 | end | ||
| 27 | end | ||
