<% contentsArray = Array.new %> <% folders.each do |folder| %> <% if Dir.exists? folder %> <% contents = Dir.children("./" + folder).grep(/#{searchquery}/) %> <% if !contents.empty? %> <% contents.each do |content| %> <% begin %> <% newPage = Page.new(folder + "/" + content) %> <% rescue %> <%# Do nothing LOLOL %> <% puts "bad times at " + content %> <% else %> <% contentsArray.push(newPage) %> <% end %> <% end %> <% end %> <% end %> <% end %> <% if contentsArray.empty? %> <%= erb :throwError, locals: {errorcode: "404", error: "No result", errordescriptor: "No pages matching " + searchquery, returntarget: origin} %> <% end %> <% contentsArray.sort_by! { |page| page.get_date } %> <% contentsArray.reverse.each do |content| %>
<%= content.render %> <%= content.get_date %> Article Page
<% end %>