feat(reading): clean and refactor routing for books -> reading to separate paths

This commit is contained in:
Cory Dransfeldt 2025-05-16 13:03:55 -07:00
parent 8d9455940e
commit 2666d6ed67
No known key found for this signature in database
21 changed files with 51 additions and 89 deletions

View file

@ -1,7 +1,7 @@
---
title: Books
description: Here's what I'm reading at the moment.
permalink: "/books/index.html"
permalink: "/reading/index.html"
schema: books
updated: "now"
---

View file

@ -3,8 +3,8 @@ pagination:
data: books.years
size: 1
alias: year
permalink: "/books/years/{{ year.value }}/index.html"
schema: books-year
permalink: "/reading/years/{{ year.value }}/index.html"
schema: reading-year
---
{%- assign bookData = year.data | filterBooksByStatus: 'finished' -%}
{%- assign bookDataFavorites = bookData | findFavoriteBooks -%}
@ -12,7 +12,7 @@ schema: books-year
{%- assign currentYear = 'now' | date: "%Y" -%}
{%- assign yearString = year.value | append: '' -%}
{%- assign currentYearString = currentYear | append: '' -%}
<a href="/books" class="back-link">{% tablericon "arrow-left" %} Back to books</a>
<a href="/reading" class="back-link">{% tablericon "arrow-left" %} Back to reading</a>
<h2 class="page-title">{{ year.value }} • Books</h2>
{% if yearString == currentYearString %}
<p>I've finished <mark>{{ bookData.size }} book{% unless bookData.size == 1 %}s{% endunless %}</mark> this year.{%- if favoriteBooks %} Among my favorites are {{ favoriteBooks }}.{%- endif -%}</p>