Skip to content

Commit 5294f4d

Browse files
Leonidas-from-XIVsabine
authored andcommitted
Render all book links (#540)
Some of the books have multiple links, it would be nice to display them all
1 parent d65c8f4 commit 5294f4d

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

src/ocamlorg_frontend/pages/books.eml

+13-12
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,18 @@ let render_books books =
2424
<% ); %>
2525
<div class="font-semibold text-base mb-6 uppercase"><%s item.authors |> String.concat ", " %></div>
2626
<div class="prose prose-orange mb-6"><%s! item.body_html %></div>
27-
<% let link = List.hd item.links in %>
28-
<a href="<%s link.uri %>">
29-
<button class="btn btn-secondary">
30-
<span><%s link.description %></span>
31-
<svg xmlns="http://www.w3.org/2000/svg" class="h-4 w-4" fill="none" viewBox="0 0 24 24"
32-
stroke="currentColor">
33-
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
34-
d="M9 5l7 7-7 7" />
35-
</svg>
36-
</button>
37-
</a>
27+
<% item.links |> List.iter (fun (link : Ood.Book.link) -> %>
28+
<a href="<%s link.uri %>">
29+
<button class="btn btn-secondary">
30+
<span><%s link.description %></span>
31+
<svg xmlns="http://www.w3.org/2000/svg" class="h-4 w-4" fill="none" viewBox="0 0 24 24"
32+
stroke="currentColor">
33+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
34+
d="M9 5l7 7-7 7" />
35+
</svg>
36+
</button>
37+
</a>
38+
<% ); %>
3839
</div>
3940
</div>
4041
<% ); %>
@@ -90,4 +91,4 @@ Layout.render
9091
</div>
9192
</div>
9293
</div>
93-
</div>
94+
</div>

0 commit comments

Comments
 (0)