diff --git a/.eleventy.js b/.eleventy.js index 435d9aa0..6c423318 100644 --- a/.eleventy.js +++ b/.eleventy.js @@ -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) => { diff --git a/package.json b/package.json index c769a3c0..b7faca6d 100644 --- a/package.json +++ b/package.json @@ -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": { diff --git a/src/_includes/book-year.liquid b/src/_includes/book-year.liquid index bfc7a240..0da28540 100644 --- a/src/_includes/book-year.liquid +++ b/src/_includes/book-year.liquid @@ -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: '' -%}

{% tablericon "arrow-left" "Go back" %} Go back

{{ content }} +{% if yearString == currentYearString %} +

I've finished {{ bookData.size }} books this year.

+{% else %}

I finished {{ bookData.size }} books in {{ year }}

+{% endif %}
{% render "partials/now/media-grid.liquid", data:bookData, shape: "vertical", count: 200, loading: "eager" %} \ No newline at end of file