% if folder == "all" %>
<% doAllFolder = true %>
<% title = "Archive" %>
<% else %>
<% doAllFolder = false %>
<% title = "Archive - " + folder.capitalize %>
<% end %>
<%= title %>
<%= erb :headerBoilerplate %>
<%= erb :asidemenu %>
<%= erb :searchTopBar, locals: {folder: folder} %>
<%= erb :searchbar, locals: {folder: folder} %>
<% if folder == "all" %>
<%= erb :index, locals: {folders: ["all", "media", "technology", "news"], searchquery: searchquery, origin: "search/" + "all"} %>
<% else %>
<% if !Dir.exists?(folder) %>
<%= erb :throwError, locals: {errorcode: "404", error: "Folder not found", errordescriptor: "No folder called " + folder.capitalize, returntarget: "search"} %>
<% else %>
<% if Dir.children("./" + folder).empty? %>
<%= erb :throwError, locals: {errorcode: "404", error: "File not found", errordescriptor: "No files in " + folder.capitalize, returntarget: "search"} %>
<% else %>
<%= erb :index, locals: {folders: [folder], searchquery: searchquery, origin: "search/" + folder} %>
<% end %>
<% end %>
<% end %>
<%# searchquery %>
<%= erb :bottom %>