-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconfig.rb
49 lines (39 loc) · 1.2 KB
/
config.rb
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
43
44
45
46
47
48
49
require_relative "lib/season"
require_relative "lib/episode"
require_relative "lib/extra"
seasons = Season.published app.data
seasons.each_with_index do |season, index|
if index == 0
season.prev_film = nil
else
season.prev_film = seasons[index-1]
end
if index == seasons.length
season.next_film = nil
else
season.next_film = seasons[index+1]
end
proxy "#{season.path}/index.html", "season.html", locals: {season: season}, ignore: true
season.episodes.each_with_index do |episode, index|
# no beginning-of-array check here because we loop around
episode.prev_film = season.episodes[index-1]
if index == season.episodes.length
episode.next_film = season.episodes.first
else
episode.next_film = season.episodes[index+1]
end
proxy "#{episode.path}/index.html", "single.html", locals: {episode: episode}, ignore: true
proxy "#{episode.path}.json", "single.json", locals: {episode: episode}, ignore: true
end
end
page "/*.json", layout: false
helpers do
def template_name
current_page.source_file.relative_path.to_s.split(".").first
end
end
configure :build do
activate :asset_hash
activate :minify_css
activate :minify_javascript
end