-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbooks.vto
60 lines (59 loc) · 2.04 KB
/
books.vto
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
58
59
60
---
title: Books
description: Find out what books I have been reading lately
---
{{ layout "core.vto" }}
<article>
<header>
<h1>Books</h1>
</header>
<div class="notice">
<hr class="hidden" />
<h3>
<span>📚</span>
How the rating system works
</h3>
<p>If a book has the loudspeaker emoji <span>(📣)</span>, it means that I found it interesting/enjoyable/compelling enough to bring it up in a discussion without being prompted.</p>
<hr class="hidden" />
</div>
<div id="post-body">
{{ for yearGroup of books }}
{{> const goalProgress = yearGroup.books.filter(b => b.progress === 100).length }}
{{> const goalCompletion = (goalProgress * 100) / yearGroup.goal }}
<div class="grid-list">
<header>
<h2>{{ yearGroup.list }}</h2>
{{ if yearGroup.goal }}
<div id="post-meta">
Yearly goal: {{ goalProgress }} / {{ yearGroup.goal }} books completed ({{ Math.round(goalCompletion) }}%)
</div>
{{ /if }}
</header>
<ul role="list">
{{ for item of yearGroup.books }}
<li>
<div>
<img alt="A cover photo of the book titled {{ item.title }}" src="{{ item.cover }}" />
<figcaption style="display: none;">You can learn more by visiting <a target="_blank" href={{ item.link }}>{{ item.link }}</a></figcaption>
<a href="{{ item.link }}" target="_blank" rel="noopener noreferer">
<span>{{ item.title }}</span>
</a>
</div>
<dl>
{{ if item.progress === 100 && item.rating !== null }}
<div>
<dd>{{ item.date_finished?.toISOString().split("T")[0] }} {{ if item.recommended }}· <span>📣</span>{{ /if }}
</div>
{{ /if }}
{{ if item.progress !== 100 }}
<p>{{ item.progress}}% read</p>
{{ /if }}
</dl>
</li>
{{ /for }}
</ul>
</div>
{{ /for }}
</div>
</article>
{{ /layout }}