Update for the new academic year
This commit is contained in:
parent
1f67ea6ea9
commit
f7ce92fc7c
2 changed files with 10 additions and 5 deletions
|
@ -19,10 +19,15 @@ module PreprocessHelper
|
||||||
end
|
end
|
||||||
|
|
||||||
def ignore_old_content(*paths)
|
def ignore_old_content(*paths)
|
||||||
@items.delete_if do |item|
|
paths.each do |path|
|
||||||
next unless item.identifier.match?(%r{^/(#{paths.join('|')})/})
|
latest_year_with_content = @items.find_all("/#{path}/**/*").map { |it| it.identifier.to_s.match(%r{/(\d\d-\d\d)/})[1] }.sort[-1]
|
||||||
year = item.identifier.to_s.match(%r{/(\d\d-\d\d)/})[1]
|
|
||||||
year != @config[:academic_year]
|
latest_year = [latest_year_with_content, @config[:academic_year]].min
|
||||||
|
@items.delete_if do |item|
|
||||||
|
next unless item.identifier.match?(%r{^/#{path}/})
|
||||||
|
year = item.identifier.to_s.match(%r{/(\d\d-\d\d)/})[1]
|
||||||
|
year != latest_year
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
title: Zeus WPI
|
title: Zeus WPI
|
||||||
academic_year: 17-18
|
academic_year: 18-19
|
||||||
# Needed for atom_feed
|
# Needed for atom_feed
|
||||||
author_name: ''
|
author_name: ''
|
||||||
author_uri: ''
|
author_uri: ''
|
||||||
|
|
Loading…
Reference in a new issue