You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

22 lines
1004 B
Plaintext

2 years ago
<% contents = Dir.children("./" + folder).grep(/#{searchquery}/) %>
<% contentsArray = Array.new %>
2 years ago
<% contents.each do |content| %>
<% if content.end_with?(".erb") || content.end_with?(".md") %>
<% if File.exists?("./" + folder + "/" + content + ".meta") %>
<% newPage = Page.new(content, DateTime.parse(File.read("./" + folder + "/" + content + ".meta"), "%Y.%m.%d")) %>
2 years ago
<% else %>
<% newPage = Page.new(content, DateTime.parse("1970.01.01", "%Y.%m.%d")) %>
2 years ago
<% end %>
<% contentsArray.push(newPage) %>
<% end %>
<% end %>
<% contentsArray.sort_by! { |page| page.getdate } %>
<% contentsArray.reverse.each do |content| %>
<% if content.getpath.end_with?(".erb") %>
<%= erb :blogpageERB, locals: {file: "./" + folder + "/" + content.getpath, date: content.getdate.strftime("%Y.%m.%d")} %>
<% elsif content.getpath.end_with?(".md") %>
<%= erb :blogpageMD, locals: {file: "./" + folder + "/" + content.getpath, date: content.getdate.strftime("%Y.%m.%d")} %>
2 years ago
<% end %>
<% end %>