From 1b004404b403283a2f0c1f8f14c6892c5b89605a Mon Sep 17 00:00:00 2001 From: Astoria Date: Sat, 17 Dec 2022 15:04:39 -0600 Subject: [PATCH] Feed fixes --- v5.rb | 3 ++- views/feed.erb | 50 +++++++++++++++++++++++--------------------------- 2 files changed, 25 insertions(+), 28 deletions(-) diff --git a/v5.rb b/v5.rb index dc61eb6..fe65c76 100755 --- a/v5.rb +++ b/v5.rb @@ -76,7 +76,8 @@ get '/contact' do end get '/feed' do - erb :feed, locals: {folders: ["media", "technology", "news"]} + content_type 'application/rss+xml' + return ERB.new(File.read("./views/feed.erb"), trim_mode: "-").result(binding) end not_found do diff --git a/views/feed.erb b/views/feed.erb index 81ca5c5..ef6339e 100644 --- a/views/feed.erb +++ b/views/feed.erb @@ -1,34 +1,30 @@ - + - Broken Moon Network https://www.broken-moon.net A personal project of Astoria. - - <% pageArray = Array.new %> - <% folders.each do |folder| %> - <% if Dir.exists? folder %> - <% contents = Dir.children("./" + folder) %> - <% if !contents.empty? %> - <% contents.each do |content| %> - <% begin %> - <% newPage = Page.new(folder + "/" + content) %> - <% rescue %> - <% puts "bad times at " + content %> - <% else %> - <% pageArray.push(newPage) %> - <% end %> - <% end %> - <% end %> - <% end %> - <% end %> - - <% pageArray.sort_by! { |page| page.get_date } %> - - <% pageArray.reverse.each do | page | %> - <%= page.get_feed_entry %> - <% end %> + <%- pageArray = Array.new -%> + <%- folders = ["media", "technology", "news"] -%> + <%- folders.each do |folder| -%> + <%- if Dir.exists? folder -%> + <%- contents = Dir.children("./" + folder) -%> + <%- if !contents.empty? -%> + <%- contents.each do |content| -%> + <%- begin -%> + <%- newPage = Page.new(folder + "/" + content) -%> + <%- rescue -%> + <%- puts "bad times at " + content -%> + <%- else -%> + <%- pageArray.push(newPage) -%> + <%- end -%> + <%- end -%> + <%- end -%> + <%- end -%> + <%- end -%> + <%- pageArray.sort_by! { |page| page.get_date } -%> + <%- pageArray.reverse.each do | page | -%> +<%=- page.get_feed_entry %> + <%- end -%> - \ No newline at end of file