diff --git a/Rules b/Rules index 01d4a99..6c7b88d 100644 --- a/Rules +++ b/Rules @@ -34,8 +34,7 @@ end passthrough '/tipuesearch_content.js' # ERB -compile '/*.erb' do - layout '/generic.*' +compile '/cammie.*' do layout '/default.*' filter :erb @@ -43,10 +42,7 @@ compile '/*.erb' do end compile '/archives/*' do - posts = items.find_all('/posts/**/*').select do |post| - post[:academic_year] == item[:academic_year] - end - + layout '/archive_page.*' layout '/generic.*' layout '/default.*' filter :erb @@ -80,6 +76,14 @@ compile '/posts/**/*', rep: :text do filter :strip_html end +compile '/*.erb' do + layout '/generic.*' + layout '/default.*' + filter :erb + + filter :relativize_paths, type: :html +end + route '/index.*' do '/index.html' end diff --git a/layouts/archive_page.erb b/layouts/archive_page.erb new file mode 100644 index 0000000..d8a056d --- /dev/null +++ b/layouts/archive_page.erb @@ -0,0 +1,10 @@ +<% posts_in_year(item[:academic_year]).each do |post| %> + +
+ <%= post[:title] %> +
+
+ <%= excerptize(post.reps[:text].compiled_content, length: 200) %> +
+
+<% end %> diff --git a/layouts/partials/_navbar.erb b/layouts/partials/_navbar.erb index 98a098b..0b3961f 100644 --- a/layouts/partials/_navbar.erb +++ b/layouts/partials/_navbar.erb @@ -2,14 +2,14 @@ About - - All posts + + Archief Contact - Search + Zoeken Cammie diff --git a/lib/archives.rb b/lib/archives.rb index c95ed46..adff811 100644 --- a/lib/archives.rb +++ b/lib/archives.rb @@ -14,7 +14,13 @@ module ArchiveHelper academic_years.map { |y| [y, items["/archives/#{y}-#{y + 1}.html"]] }.to_h end - def pretty_year(y) - "'#{y} - '#{y + 1}" + def pretty_year(year) + "'#{year} - '#{year + 1}" + end + + def posts_in_year(academic_year) + items.find_all('/posts/**/*').select do |post| + post[:academic_year] == academic_year + end end end