74 lines
2.3 KiB
Text
74 lines
2.3 KiB
Text
---
|
|
title: Reading
|
|
description: Here's what I'm reading at the moment.
|
|
permalink: "/reading/index.php"
|
|
schema: books
|
|
eleventyComputed:
|
|
page:
|
|
activeUrl: "/reading"
|
|
---
|
|
<?php
|
|
|
|
require_once __DIR__ . '/../bootstrap.php';
|
|
|
|
use App\Classes\BookProgressHandler;
|
|
|
|
$progressHandler = new BookProgressHandler();
|
|
$progressData = $progressHandler->getAllProgress();
|
|
|
|
?>
|
|
{%- assign currentYear = 'now' | date: "%Y" -%}
|
|
{%- assign bookData = books.all | filterBooksByStatus: 'started' | reverse -%}
|
|
{%- assign currentBookCount = books.currentYear | size -%}
|
|
<h2 class="page-title">Reading</h2>
|
|
<p>Here's what I'm reading at the moment. I've finished <mark>{{ currentBookCount }} books</mark> this year. I've read <mark>{{ books.daysRead }}</mark> days in a row and counting.</p>
|
|
{% render "static/blocks/top-tags.liquid"
|
|
label:"Top genres"
|
|
tags:topTags.books_genres
|
|
%}
|
|
<p class="book-years">{{ books.years | bookYearLinks }}</p>
|
|
{% render "static/blocks/banners/rss.liquid",
|
|
url: "/feeds/books.xml",
|
|
text: "Subscribe to my books feed or follow along on this page"
|
|
%}
|
|
<hr />
|
|
{% for book in bookData %}
|
|
{% capture alt %}{{ book.title }} by {{ book.authors }}{% endcapture %}
|
|
<article class="book-entry">
|
|
<a href="{{ book.url }}">
|
|
<img
|
|
srcset="
|
|
{{ book.image }}?class=verticalsm&type=webp 200w,
|
|
{{ book.image }}?class=verticalmd&type=webp 400w
|
|
"
|
|
sizes="(max-width: 450px) 200px,
|
|
400px"
|
|
src="{{ book.image }}?class=verticalsm&type=webp"
|
|
alt="{{ alt | replaceQuotes }}"
|
|
loading="lazy"
|
|
decoding="async"
|
|
width="200"
|
|
height="307"
|
|
>
|
|
</a>
|
|
<div class="media-meta">
|
|
<a href="{{ book.url }}">
|
|
<h2>{{ book.title }}</h2>
|
|
</a>
|
|
{% if book.author %}
|
|
<span class="sub-meta">By {{ book.author }}</span>
|
|
{% endif %}
|
|
<?php
|
|
$isbn = '{{ book.isbn | escape }}';
|
|
$progress = $progressData[$isbn] ?? null;
|
|
if (isset($progress)):
|
|
?>
|
|
<progress value="<?= htmlspecialchars($progress) ?>" max="100"><?= htmlspecialchars($progress) ?>%</progress>
|
|
<?php endif; ?>
|
|
{% if book.description %}
|
|
<div class="description">{{ book.description | normalize_whitespace | markdown | htmlTruncate }}</div>
|
|
{% endif %}
|
|
</div>
|
|
</article>
|
|
{% endfor %}
|
|
|