Search update.
parent
629fbe0b95
commit
0ad91dad0a
@ -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 %>
|
@ -0,0 +1,11 @@
|
||||
<div class="section upperdirs">
|
||||
<span class="homesubmessage">
|
||||
<b>
|
||||
<a href="/">Home</a>
|
||||
>
|
||||
<a href="/archive">Archive</a>
|
||||
>
|
||||
<a href="/archive/<%= folder %>"><%=folder.capitalize %></a>
|
||||
</b>
|
||||
</span>
|
||||
</div>
|
@ -0,0 +1,44 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<% if folder == "all" %>
|
||||
<% doAllFolder = true %>
|
||||
<% title = "Archive" %>
|
||||
<% else %>
|
||||
<% doAllFolder = false %>
|
||||
<% title = "Archive - " + folder.capitalize %>
|
||||
<% end %>
|
||||
<head>
|
||||
<title><%= title %></title>
|
||||
<meta name="description" content="broken-moon.net - <%= title %>" />
|
||||
<meta name="keywords" content="<%= title.downcase %>" />
|
||||
<meta property="og:url" content="http://broken-moon.net/<%= title.downcase %>" />
|
||||
<meta property="og:title" content="<%= title %>" />
|
||||
<%= erb :headerBoilerplate %>
|
||||
</head>
|
||||
<body>
|
||||
<%= erb :asidemenu %>
|
||||
<div class="content">
|
||||
<%= 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 %>
|
||||
</div>
|
||||
<%= erb :bottom %>
|
||||
</body>
|
@ -0,0 +1,7 @@
|
||||
<div class="section numlist center>
|
||||
<span class="homesubmessage">
|
||||
<b>
|
||||
<a href="/archive<%= folder %>">Search <%= title %> Posts<a>
|
||||
</b>
|
||||
</span>
|
||||
</div>
|
@ -0,0 +1,7 @@
|
||||
<div class="section numlist center>
|
||||
<span class="homesubmessage">
|
||||
<b>
|
||||
<a href="/archive/all">Search All Posts<a>
|
||||
</b>
|
||||
</span>
|
||||
</div>
|
@ -0,0 +1,7 @@
|
||||
<div class="section search center">
|
||||
<form method="GET" action="/archive/<%= folder %>">
|
||||
Search:
|
||||
<input name="search">
|
||||
<input type="submit" value=">">
|
||||
</form>
|
||||
</div>
|
Loading…
Reference in New Issue