howtos rss

This commit is contained in:
2026-07-29 09:42:42 +02:00
parent 8ca87407b4
commit 9219dd08bc
6 changed files with 36 additions and 1 deletions
@@ -17,4 +17,11 @@ class Api::RssController < ApiController
xml = RssService.new.releases_feed
render xml: xml, content_type: "application/rss+xml"
end
api :GET, "/api/rss/howtos", "HowTos RSS feed"
returns code: 200, desc: "RSS XML feed of tech howtos"
def howtos
xml = RssService.new.howtos_feed
render xml: xml, content_type: "application/rss+xml"
end
end
+22
View File
@@ -2,6 +2,7 @@ require "rss"
class RssService
SITE_URL = ENV.fetch("SITE_URL", "https://teletypegames.org").freeze
WIKI_URL = ENV.fetch("WIKI_URL", "https://wiki.teletypegames.org").freeze
def blog_feed
pages = WikiService.new.pages(tag: "blog", limit: 30)
@@ -48,4 +49,25 @@ class RssService
end
end.to_s
end
def howtos_feed
pages = WikiService.new.pages(tag: "howto", limit: 30)
items = pages.fetch("pages", [])
RSS::Maker.make("2.0") do |maker|
maker.channel.title = "Teletype Games HowTos"
maker.channel.link = "#{SITE_URL}/howtos"
maker.channel.description = "Latest tech howtos from Teletype Games"
maker.channel.language = "hu"
items.each do |page|
maker.items.new_item do |item|
item.title = page["title"]
item.link = "#{WIKI_URL}/#{page["path"]}"
item.description = page["description"].to_s
item.pubDate = Time.parse(page["createdAt"]) rescue Time.current
end
end
end.to_s
end
end
+1 -1
View File
@@ -16,7 +16,7 @@ ActiveAdmin.setup do |config|
admin.build_menu :utility_navigation do |menu|
menu.add id: "site_link",
label: "🏠",
url: "/",
url: ENV.fetch("SITE_URL", "https://teletypegames.org"),
html_options: { target: "_blank", title: "Open site", style: "font-size:18px;" },
priority: 1
+1
View File
@@ -13,6 +13,7 @@ Rails.application.routes.draw do
get "wiki/pages", to: "wiki#index"
get "rss/blog", to: "rss#blog"
get "rss/releases", to: "rss#releases"
get "rss/howtos", to: "rss#howtos"
get "download", to: "downloads#show"
end
get "update", to: "update#update"