chore: clearer organizational distinction between data-generated (dynamic) pages and strictly markdown ones

This commit is contained in:
Cory Dransfeldt 2024-07-16 15:37:30 -07:00
parent a8beefaa4a
commit 4dca0dfb3e
No known key found for this signature in database
36 changed files with 541 additions and 198 deletions

View file

@ -0,0 +1,61 @@
---
layout: default
pagination:
data: books.all
size: 1
alias: book
permalink: "{{ book.url }}/index.html"
isbn: {{ book.isbn }}
schema: book
---
{%- capture alt -%}
{{ book.title }}{% if book.authors %}By {{ book.authors }}{% endif %}
{%- endcapture -%}
<a class="back-link-header link-icon" href="/books" title="Go back to the books index page">{% tablericon "arrow-left" "Go back to the books index page" %} Back to books</a>
<article class="book-focus">
<div class="book-display">
<img
srcset="
https://cdn.coryd.dev{{ book.image }}?class=verticalsm 200w,
https://cdn.coryd.dev{{ book.image }}?class=verticalmd 400w,
https://cdn.coryd.dev{{ book.image }}?class=verticalbase 800w,
https://cdn.coryd.dev{{ book.image }}?class=verticallg 1200w
"
sizes="(max-width: 450px) 203px,
(max-width: 850px) 406px,
(max-width: 1000px) 812px,
1624px"
src="https://cdn.coryd.dev{{ book.image }}?class=verticallg"
alt="{{ alt }}"
loading="eager"
decoding="async"
width="200"
height="307"
/>
<div class="book-meta">
<p class="title"><strong>{{ book.title }}</strong></p>
{% if book.rating %}<p>{{ book.rating }}</p>{% endif %}
{% if book.author %}
<p class="sub-meta">By {{ book.author }}</p>
{% endif %}
{% if book.status == 'finished' %}
<p class="sub-meta">Finished on: {{ book.date | date: "%B %e, %Y" }}</p>
{% endif %}
{% unless book.status == 'finished' %}
{%- assign percentage = book.progress | append: '%' -%}
{% render "partials/media/progress-bar.liquid", percentage:percentage %}
{% endunless %}
<p class="sub-meta"><a href="https://openlibrary.org/isbn/{{ book.isbn }}" title="View {{ book.title | escape }} on Open Library">View on Open Library</a></p>
</div>
</div>
{% if book.review %}
{% render "partials/blocks/banners/warning.liquid", text: "There are probably spoilers after this banner — this is a warning about them." %}
<h3>My thoughts</h3>
{{ book.review | markdown }}
<hr />
{% endif %}
{% if book.description %}
<h3>Overview</h3>
{{ book.description | markdown }}
{% endif %}
</article>

View file

@ -0,0 +1,53 @@
---
title: Currently reading / Books
description: Here's what I'm reading at the moment.
layout: default
permalink: "/books/index.html"
updated: "now"
schema: books
---
{%- assign bookData = books.all | bookStatus: 'started' | reverse -%}
{%- assign currentBookCount = books.all | currentBookCount -%}
<h2 class="page-header">Currently reading</h2>
<p>Here's what I'm reading at the moment. I've finished <strong class="highlight-text">{{ currentBookCount }} books</strong> this year.</p>
<p>{{ books.years | bookYearLinks }}</p>
{% render "partials/blocks/banners/rss.liquid", url: "https://feedpress.me/coryd-books", 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="
https://cdn.coryd.dev{{ book.image }}?class=verticalsm 200w,
https://cdn.coryd.dev{{ book.image }}?class=verticalmd 400w,
https://cdn.coryd.dev{{ book.image }}?class=verticalbase 800w,
https://cdn.coryd.dev{{ book.image }}?class=verticallg 1200w
"
sizes="(max-width: 450px) 200px,
(max-width: 850px) 400px,
(max-width: 1000px) 800px,
1200px"
src="https://cdn.coryd.dev{{ book.image }}?class=verticallg 1200w"
alt="{{ alt }}"
loading="eager"
decoding="async"
width="200"
height="307"
/>
</a>
<div class="book-meta">
<a href="{{ book.url }}">
<p class="title"><strong>{{ book.title }}</strong></p>
</a>
{% if book.author %}
<p class="sub-meta">By {{ book.author }}</p>
{% endif %}
{% if book.progress %}
{%- assign percentage = book.progress | append: '%' -%}
{% render "partials/media/progress-bar.liquid", percentage:percentage %}
{% endif %}
{% if book.description %}<div class="description">{{ book.description | markdown | truncate: 300 }}</div>{% endif %}
</div>
</article>
{% endfor %}

View file

@ -0,0 +1,24 @@
---
layout: default
pagination:
data: books.years
size: 1
alias: year
permalink: "/books/years/{{ year.value }}.html"
schema: books-year
---
{%- assign bookData = year.data | bookStatus: 'finished' | bookSortDescending -%}
{%- assign bookDataFavorites = bookData | bookFavorites -%}
{%- capture favoriteBooks -%}{{ bookDataFavorites | shuffleArray | mediaLinks: "book", 5 }}{%- endcapture -%}
{%- capture currentYear -%}{% currentYear %}{%- endcapture -%}
{%- assign yearString = year.value | append: '' -%}
{%- assign currentYearString = currentYear | append: '' -%}
<a class="back-link-header link-icon" href="/books" title="Go back to the books index page">{% tablericon "arrow-left" "Go back to the books index page" %} Back to books</a>
<h2 class="page-header">{{ year.value }} / Books</h2>
{% if yearString == currentYearString %}
<p>I've finished <strong class="highlight-text">{{ bookData.size }} books</strong> this year. Among my favorites are {{ favoriteBooks }}.</p>
{% else %}
<p>I finished <strong class="highlight-text">{{ bookData.size }} books</strong> in <strong class="highlight-text">{{ year.value }}</strong>. Among my favorites were {{ favoriteBooks }}.</p>
{% endif %}
<hr />
{% render "partials/media/grid.liquid", data:bookData, shape: "vertical", count: 200, loading: "eager" %}