Serve engine-tagged wiki pages on a new /engines section
Frontend: /engines index + /engines/:slug detail routes, nav menu item and en/hu translations. Engine pages are few, so the index uses an emphasized poster-style design (dark slate, emerald accents, numbered full-width cards with content preview) instead of the blog/howtos layouts. Slugs are the last wiki path segment, since engine pages live scattered in the wiki tree. API: /api/rss/engines feed linking to the site's engine pages, and a WikiService#pages alias for #index — RssService called the alias-less name, so the blog and howtos feeds were raising NoMethodError.
This commit is contained in:
@@ -24,4 +24,11 @@ class Api::RssController < ApiController
|
||||
xml = RssService.new.howtos_feed
|
||||
render xml: xml, content_type: "application/rss+xml"
|
||||
end
|
||||
|
||||
api :GET, "/api/rss/engines", "Engines RSS feed"
|
||||
returns code: 200, desc: "RSS XML feed of in-house engines"
|
||||
def engines
|
||||
xml = RssService.new.engines_feed
|
||||
render xml: xml, content_type: "application/rss+xml"
|
||||
end
|
||||
end
|
||||
|
||||
@@ -4,7 +4,7 @@ class Api::WikiController < ApiController
|
||||
end
|
||||
|
||||
api :GET, "/api/wiki/pages", "List wiki pages filtered by tag"
|
||||
param :tag, String, required: false, desc: "Filter by tag (blog, howto)"
|
||||
param :tag, String, required: false, desc: "Filter by tag (blog, howto, engine)"
|
||||
param :limit, :number, required: false, desc: "Limit number of results"
|
||||
param :body, String, required: false, desc: "Include body content (1 = yes)"
|
||||
returns code: 200, desc: "Wiki pages response" do
|
||||
|
||||
@@ -50,6 +50,28 @@ class RssService
|
||||
end.to_s
|
||||
end
|
||||
|
||||
def engines_feed
|
||||
pages = WikiService.new.pages(tag: "engine", limit: 30)
|
||||
items = pages.fetch("pages", [])
|
||||
|
||||
RSS::Maker.make("2.0") do |maker|
|
||||
maker.channel.title = "Teletype Games Engines"
|
||||
maker.channel.link = "#{SITE_URL}/engines"
|
||||
maker.channel.description = "In-house engines and frameworks from Teletype Games"
|
||||
maker.channel.language = "hu"
|
||||
|
||||
items.each do |page|
|
||||
maker.items.new_item do |item|
|
||||
slug = page["path"].to_s.split("/").last
|
||||
item.title = page["title"]
|
||||
item.link = "#{SITE_URL}/engines/#{slug}"
|
||||
item.description = page["description"].to_s
|
||||
item.pubDate = Time.parse(page["createdAt"]) rescue Time.current
|
||||
end
|
||||
end
|
||||
end.to_s
|
||||
end
|
||||
|
||||
def howtos_feed
|
||||
pages = WikiService.new.pages(tag: "howto", limit: 30)
|
||||
items = pages.fetch("pages", [])
|
||||
|
||||
@@ -43,4 +43,7 @@ class WikiService
|
||||
rescue StandardError => e
|
||||
{ "tag" => tag, "count" => 0, "pages" => [], "error" => e.message }
|
||||
end
|
||||
|
||||
# Az RSS feedek ezen a néven hívják.
|
||||
alias_method :pages, :index
|
||||
end
|
||||
|
||||
@@ -11,6 +11,7 @@ Rails.application.routes.draw do
|
||||
get "rss/blog", to: "rss#blog"
|
||||
get "rss/releases", to: "rss#releases"
|
||||
get "rss/howtos", to: "rss#howtos"
|
||||
get "rss/engines", to: "rss#engines"
|
||||
end
|
||||
|
||||
# Utolsó sor: a host route-jai nyernek, a katalógus-útvonalakat
|
||||
|
||||
Reference in New Issue
Block a user