chore: more context on dates

This commit is contained in:
Cory Dransfeldt 2024-05-03 16:36:15 -07:00
parent e3e24f2499
commit f034ae2584
No known key found for this signature in database
3 changed files with 11 additions and 2 deletions

View file

@ -12,6 +12,7 @@ import filters from './config/filters/index.js'
import { slugifyString } from './config/utils/index.js'
import { minifyJsComponents } from './config/events/index.js'
import { searchIndex, tagList, postStats, tagsSortedByCount, links, tagMap, booksToRead } from './config/collections/index.js'
import { DateTime } from 'luxon'
// load .env
import dotenvFlow from 'dotenv-flow'
@ -116,6 +117,7 @@ export default async function (eleventyConfig) {
// shortcodes
eleventyConfig.addShortcode('appVersion', () => appVersion)
eleventyConfig.addShortcode('currentYear', () => DateTime.now().year)
// transforms
eleventyConfig.addTransform('html-minify', (content, path) => {

View file

@ -1,6 +1,6 @@
{
"name": "coryd.dev",
"version": "13.6.5",
"version": "13.6.6",
"description": "The source for my personal site. Built using 11ty.",
"type": "module",
"scripts": {

View file

@ -1,10 +1,17 @@
---
layout: default
---
{% assign bookData = books | bookStatus: 'finished' | bookFinishedYear: year %}
{%- assign bookData = books | bookStatus: 'finished' | bookFinishedYear: year -%}
{%- capture currentYear -%}{% currentYear %}{%- endcapture -%}
{%- assign yearString = year | append: '' -%}
{%- assign currentYearString = currentYear | append: '' -%}
<p><a class="link-arrow flex-centered" href="/books">{% tablericon "arrow-left" "Go back" %} Go back</a></p>
<h2 class="page-header">{{ title }}</h2>
{{ content }}
{% if yearString == currentYearString %}
<p>I've finished <strong class="highlight-text">{{ bookData.size }} books</strong> this year.</p>
{% else %}
<p>I finished <strong class="highlight-text">{{ bookData.size }} books</strong> in {{ year }}</p>
{% endif %}
<hr class="large-spacing" />
{% render "partials/now/media-grid.liquid", data:bookData, shape: "vertical", count: 200, loading: "eager" %}