-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathRules
42 lines (33 loc) · 850 Bytes
/
Rules
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/usr/bin/env ruby
preprocess do
# sorted_articles is sorted from most to least recent
@config[:first_comic] = sorted_articles.last
@config[:last_comic] = sorted_articles.first
next_comic = nil
previous_comic = nil
sorted_articles.each_with_index do |item, index|
if index > 0
item[:next_comic] = sorted_articles[index - 1]
end
if sorted_articles[index + 1]
item[:previous_comic] = sorted_articles[index + 1]
end
end
end
compile '/**/*.html' do
filter :erb
layout '/default.*'
write item.identifier.without_ext + '/index.html'
# If this is the latest comic, make it the homepage
if item == @config[:last_comic]
write '/index.html'
end
end
compile '/atom.xml' do
filter :erb
write item.identifier.to_s
end
compile '/**/*' do
write item.identifier.to_s
end
layout '/**/*', :erb