pages/_layouts/book-shelf.liquid
George 2bbc8ad544
Fixed dates in book-shelf (#3446)
Fixes #3443.

Signed-off-by: George Araújo <george.gcac@gmail.com>
2026-01-15 10:53:02 -03:00

50 lines
1.9 KiB
Plaintext

---
layout: page
---
{{ content }}
{% if page.collection and page.collection.size > 0 %}
{% assign collection = site[page.collection] %}
{% if collection and collection.size > 0 %}
{% for item in collection reversed %}
{% assign current_year = item.started | date: '%Y' %}
{% if current_year != year %}
{% unless forloop.first %}
</ul>
{% endunless %}
<h1 id="y{{item.started | date: "%Y"}}">
<a href="{{ current_year | prepend: '/books/' | relative_url }}">{{ current_year }}</a>
</h1>
<ul>
{% assign year = current_year %}
{% endif %}
<figure class="cover">
<a class="cover-link" href="{{ item.url | relative_url }}">
{% if item.cover %}
<img alt="{{ item.title }} cover" src="{{ item.cover | prepend: page.covers | relative_url }}" style="height:200px">
{% elsif item.olid %}
<img alt="{{ item.title }} cover" src="http://covers.openlibrary.org/b/olid/{{ item.olid }}-L.jpg?default=false" style="height:200px">
{% elsif item.isbn %}
<img alt="{{ item.title }} cover" src="http://covers.openlibrary.org/b/isbn/{{ item.isbn }}-L.jpg?default=false" style="height:200px">
{% endif %}
{% if item.status %}
{% assign statuses = 'abandoned,finished,interested,paused,queued,reading,reread' | split: ',' %}
{% assign status = item.status | downcase | strip %}
{% if statuses contains status %}
<figcaption class="{{ status | downcase }}">{{ status | upcase }}</figcaption>
{% else %}
<figcaption class="uncategorized">UNCATEGORIZED</figcaption>
{% endif %}
{% else %}
<figcaption class="uncategorized">UNCATEGORIZED</figcaption>
{% endif %}
</a>
</figure>
{% if forloop.last %}
</ul>
{% endif %}
{% endfor %}
{% endif %}
{% endif %}