diff --git a/v5.rb b/v5.rb
index 3ba8b50..ea20901 100644
--- a/v5.rb
+++ b/v5.rb
@@ -47,7 +47,15 @@ get '/news/*' do
end
get '/archive' do
- erb :archivepage
+ erb :archivepage, locals: {folder: "all", searchquery: ""}
+end
+
+get '/archive/' do
+ erb :archivepage, locals: {folder: "all", searchquery: ""}
+end
+
+get '/archive/:folder' do
+ erb :archivepage, locals: {folder: params["folder"].downcase, searchquery: params["search"]}
end
get '/about' do
diff --git a/views/archiveFolderIndex.erb b/views/archiveFolderIndex.erb
new file mode 100644
index 0000000..0720e11
--- /dev/null
+++ b/views/archiveFolderIndex.erb
@@ -0,0 +1,18 @@
+<% contents = Dir.children("./" + folder).grep(/#{searchquery}/) %>
+<% contents.each do |content| %>
+ <% if content.end_with?(".erb") %>
+ <% file = content %>
+ <% if File.exists?("./" + folder + "/" + file + ".meta") %>
+ <%= erb :blogpageERB, locals: {file: "./" + folder + "/" + content, meta: "./" + folder + "/" + file + ".meta"} %>
+ <% else %>
+ <%= erb :blogpageERB, locals: {file: "./" + folder+ "/" + content} %>
+ <% end %>
+ <% elsif content.end_with?(".md") %>
+ <% file = content %>
+ <% if File.exists?("./" + folder + "/" + file + ".meta") %>
+ <%= erb :blogpageMD, locals: {file: "./" + folder + "/" + content, meta: "./" + folder + "/" + file + ".meta"} %>
+ <% else %>
+ <%= erb :blogpageMD, locals: {file: "./" + folder + "/" + content} %>
+ <% end %>
+ <% end %>
+<% end %>
\ No newline at end of file
diff --git a/views/archiveTopBar.erb b/views/archiveTopBar.erb
new file mode 100644
index 0000000..da983d9
--- /dev/null
+++ b/views/archiveTopBar.erb
@@ -0,0 +1,11 @@
+
\ No newline at end of file
diff --git a/views/archivepage.erb b/views/archivepage.erb
new file mode 100644
index 0000000..3b2483a
--- /dev/null
+++ b/views/archivepage.erb
@@ -0,0 +1,44 @@
+
+
+<% if folder == "all" %>
+ <% doAllFolder = true %>
+ <% title = "Archive" %>
+<% else %>
+ <% doAllFolder = false %>
+ <% title = "Archive - " + folder.capitalize %>
+<% end %>
+
+ <%= title %>
+
+
+
+
+ <%= erb :headerBoilerplate %>
+
+
+ <%= erb :asidemenu %>
+
+ <%= erb :archiveTopBar, locals: {folder: folder} %>
+ <%= erb :searchbar, locals: {folder: folder} %>
+ <% if folder == "all" %>
+ <% foldersOfInterest = ["media", "technology", "news"] %>
+ <% foldersOfInterest.each do |multiFolder| %>
+ <% if Dir.exist?("./" + multiFolder) %>
+ <% if !Dir.children("./" + multiFolder).grep(/erb/).grep(/#{searchquery}/).empty? || !Dir.children("./" + multiFolder).grep(/md/).grep(/#{searchquery}/).empty? %>
+ <%= erb :archiveFolderIndex, locals: {folder: multiFolder, searchquery: searchquery} %>
+ <% end %>
+ <% end %>
+ <% end %>
+ <% elsif Dir.exist?("./" + folder) %>
+ <% if !Dir.children("./" + folder).grep(/erb/).grep(/#{searchquery}/).empty? || !Dir.children("./" + folder).grep(/md/).grep(/#{searchquery}/).empty? %>
+ <%= erb :archiveFolderIndex, locals: {folder: folder, searchquery: searchquery} %>
+ <% else %>
+ <%= erb :noFile %>
+ <% end %>
+ <% else %>
+ <%= erb :noFolder %>
+ <% end %>
+ <%# searchquery %>
+
+ <%= erb :bottom %>
+
\ No newline at end of file
diff --git a/views/blogpageERB.erb b/views/blogpageERB.erb
index c3a44ba..16f96ee 100644
--- a/views/blogpageERB.erb
+++ b/views/blogpageERB.erb
@@ -6,6 +6,6 @@
<%= File.read(meta) %>
<% end %>
- Article Page
+ Article Page
\ No newline at end of file
diff --git a/views/blogpageMD.erb b/views/blogpageMD.erb
index 7ca8da7..e942baa 100644
--- a/views/blogpageMD.erb
+++ b/views/blogpageMD.erb
@@ -6,6 +6,6 @@
<%= File.read(meta) %>
<% end %>
- Article Page
+ Article Page
\ No newline at end of file
diff --git a/views/folderArchive.erb b/views/folderArchive.erb
new file mode 100644
index 0000000..2abb05f
--- /dev/null
+++ b/views/folderArchive.erb
@@ -0,0 +1,7 @@
+
\ No newline at end of file
diff --git a/views/folderpage.erb b/views/folderpage.erb
index 5285248..9ec49a8 100644
--- a/views/folderpage.erb
+++ b/views/folderpage.erb
@@ -23,10 +23,12 @@
<% end %>
<%= erb :folderIndex %>
+ <%= erb :folderArchive, locals: {folder: request.path_info, title: title} %>
<% else %>
<%= erb :noFile %>
<% end %>
<% else %>
+ <%= erb :topbar %>
<%= erb :noFolder %>
<% end %>
diff --git a/views/homeArchive.erb b/views/homeArchive.erb
new file mode 100644
index 0000000..09dd34d
--- /dev/null
+++ b/views/homeArchive.erb
@@ -0,0 +1,7 @@
+
\ No newline at end of file
diff --git a/views/homepage.erb b/views/homepage.erb
index 3cc4b8d..7ec77b2 100644
--- a/views/homepage.erb
+++ b/views/homepage.erb
@@ -13,6 +13,7 @@
<%= erb :homeImage %>
<%= erb :homeIndex %>
+ <%= erb :homeArchive %>
<%= erb :bottom %>
\ No newline at end of file
diff --git a/views/noFile.erb b/views/noFile.erb
index 521340f..2c7ff10 100644
--- a/views/noFile.erb
+++ b/views/noFile.erb
@@ -1,4 +1,3 @@
-<%= erb :topbar %>
\ No newline at end of file
diff --git a/views/noFolder.erb b/views/noFolder.erb
index 1ea6115..dd5bfd2 100644
--- a/views/noFolder.erb
+++ b/views/noFolder.erb
@@ -1,4 +1,3 @@
-<%= erb :topbar %>