mirror of
https://github.com/neocities/neocities.git
synced 2025-04-24 17:22:35 +02:00
refactor RSS from Atom to 2.0 and hopefully get it working without guids
This commit is contained in:
parent
2f6ba312dc
commit
f261db16b0
2 changed files with 16 additions and 10 deletions
|
@ -1488,6 +1488,10 @@ class Site < Sequel::Model
|
|||
File.exist? File.join(base_screenshots_path, "#{path}.#{resolution}.webp")
|
||||
end
|
||||
|
||||
def sharing_screenshot_url
|
||||
'https://neocities.org'+base_screenshots_url+'/index.html.jpg'
|
||||
end
|
||||
|
||||
def screenshot_url(path, resolution)
|
||||
path[0] = '' if path[0] == '/'
|
||||
out = ''
|
||||
|
@ -1518,18 +1522,20 @@ class Site < Sequel::Model
|
|||
end
|
||||
|
||||
def to_rss
|
||||
RSS::Maker.make("atom") do |maker|
|
||||
maker.channel.title = title
|
||||
maker.channel.updated = (updated_at ? updated_at : created_at)
|
||||
maker.channel.author = username
|
||||
maker.channel.id = "#{username}.neocities.org"
|
||||
RSS::Maker.make("2.0") do |m|
|
||||
m.channel.title = title
|
||||
m.channel.link = uri
|
||||
m.channel.description = "Site feed for #{title}"
|
||||
m.image.url = sharing_screenshot_url
|
||||
m.image.title = title
|
||||
|
||||
|
||||
latest_events.each do |event|
|
||||
if event.site_change_id
|
||||
maker.items.new_item do |item|
|
||||
item.link = "https://#{host}"
|
||||
item.title = "#{title} has been updated"
|
||||
item.updated = event.site_change.created_at
|
||||
m.items.new_item do |i|
|
||||
i.title = "#{title} has been updated."
|
||||
i.link = "https://neocities.org/site/#{username}?event_id=#{event.id.to_s}"
|
||||
i.pubDate = event.created_at
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
page_uri = site.uri
|
||||
end
|
||||
%>
|
||||
<a href="/site/<%= site.username %>.rss" target="_blank"><span>RSS/Atom Feed</span></a>
|
||||
<a href="/site/<%= site.username %>.rss" target="_blank"><span>RSS Feed</span></a>
|
||||
<br>
|
||||
<a href="https://facebook.com/sharer.php?<%= Rack::Utils.build_query(u: "#{page_uri}") %>" target="_blank">Facebook</a>
|
||||
<br>
|
||||
|
|
Loading…
Add table
Reference in a new issue