This repository has been archived by the owner on Nov 10, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 22
/
dato.config.rb
57 lines (51 loc) · 1.84 KB
/
dato.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
50
51
52
53
54
55
56
57
directory "_data/" do
create_data_file "homepage.yml", :yaml,
site_name: dato.homepage.site_name,
tag_line: dato.homepage.tag_line,
description: dato.homepage.description
end
directory "_seasons" do
dato.seasons.each do |season|
create_post "#{season.slug}.md" do
frontmatter :yaml,
title: season.name,
image_url: season.image.file.width(400).to_url,
thumbnail_url: season.image.file.height(300).to_url,
bg_url: season.image.file.width(5).to_url,
weight: season.position
content season.overview
end
end
end
directory "_episodes" do
dato.episodes.sort_by { |e| [e.season.id.to_i, e.episode_number] }.each_with_index do |episode, i|
create_post "#{episode.slug}.md" do
frontmatter :yaml,
title: episode.title,
episode_number: episode.episode_number,
palette_url: episode.image && episode.image.file.auto("enhance").palette("json").to_url,
image_url: episode.image && episode.image.file.width(500).to_url,
thumbnail_url: episode.image && episode.image.file.width(500).height(280).fit("crop").auto("enhance").format(:jpg).to_url,
date: episode.first_aired.to_s,
weight: i,
rating: episode.rating,
director: episode.director,
category: episode.season.name
content episode.description
end
end
end
directory "_characters" do
dato.characters.each do |character|
create_post "#{character.slug}.md" do
frontmatter :yaml,
title: character.name,
actor_name: character.actor_name,
episodes: character.episode,
weight: character.position,
thumbnail_url: character.image.file.fit('crop').crop('faces').width(200).height(200).to_url,
image_url: character.image.file.width(500).format(:jpg).to_url
content character.description
end
end
end