{{ title }}
- {% if subtitle %}{{ subtitle }}
{% endif %} - {% if rating %}- ca. {{ year }} -
- {% endif %} --
- {% for tag in filteredTags %}
-
- - {% include "svgs/frame.svg" %} - {{ tag }} - - {% endfor %} -
diff --git a/config/collections/index.js b/config/collections/index.js
index d17dcc8..cbb0a2a 100644
--- a/config/collections/index.js
+++ b/config/collections/index.js
@@ -15,6 +15,21 @@ export const postsByTag = (collection) => {
return postsByTag;
};
+export const collectionByTag = (collection, collectionName) => {
+ const items = collection.getFilteredByTag(collectionName);
+
+ const itemsByTag = {};
+
+ for (const item of items) {
+ for (const tag of item.data.tags) {
+ itemsByTag[tag] ??= [];
+ itemsByTag[tag].push(item);
+ }
+ }
+
+ return itemsByTag;
+};
+
export const catalogueByType = (collection) => {
const allItems = collection.getFilteredByTag("catalogue");
diff --git a/config/filters/index.js b/config/filters/index.js
index d4b1f5e..b2d5e3e 100644
--- a/config/filters/index.js
+++ b/config/filters/index.js
@@ -78,13 +78,6 @@ export const pluralize = (string, count = 0) => {
return pluralizeBase(string, count);
};
-export const filterCatalogueTags = (tags) => {
- // In the case of catalogue items, the 0-index is "catalogue"
- // and the 1-index is the catalogueType. We don't need to
- // show those in the front-end.
- return filter(tags, [tags[0], tags[1]]);
-};
-
export const limit = (collection, limit = 5) => collection.slice(0, limit);
export const filterFavourites = (collection) => {
diff --git a/eleventy.config.js b/eleventy.config.js
index fa25ef7..e4a9c44 100644
--- a/eleventy.config.js
+++ b/eleventy.config.js
@@ -3,14 +3,17 @@ import pluginRss from "@11ty/eleventy-plugin-rss";
import pluginNoRobots from "eleventy-plugin-no-robots";
import { eleventyImageTransformPlugin } from "@11ty/eleventy-img";
-import { catalogueByType, postsByTag } from "./config/collections/index.js";
+import {
+ catalogueByType,
+ collectionByTag,
+ postsByTag,
+} from "./config/collections/index.js";
import { dir } from "./config/constants.js";
import {
allTagCounts,
entries,
filter,
- filterCatalogueTags,
filterFavourites,
formatDate,
isOld,
@@ -34,29 +37,16 @@ export default function (eleventyConfig) {
eleventyConfig.addPlugin(pluginNoRobots);
// --------------------- Custom Collections -----------------------
- eleventyConfig.addCollection("gamesByYear", (collection) => {
- const data = collection.getFilteredByTag("game");
- const byYear = transformByDate(data);
- return byYear;
- });
- eleventyConfig.addCollection("booksByYear", (collection) => {
- const data = collection.getFilteredByTag("book");
- const byYear = transformByDate(data);
- return byYear;
- });
- eleventyConfig.addCollection("moviesByYear", (collection) => {
- const data = collection.getFilteredByTag("movie");
- const byYear = transformByDate(data);
- return byYear;
- });
- eleventyConfig.addCollection("catalogueByType", catalogueByType);
eleventyConfig.addCollection("postsByTag", postsByTag);
+ eleventyConfig.addCollection("booksByTag", (collection) => {
+ const data = collectionByTag(collection, "book");
+ return data;
+ });
// --------------------- Custom Filters -----------------------
eleventyConfig.addFilter("allTagCounts", allTagCounts);
eleventyConfig.addFilter("entries", entries);
eleventyConfig.addFilter("filter", filter);
- eleventyConfig.addFilter("filterCatalogueTags", filterCatalogueTags);
eleventyConfig.addFilter("filterFavourites", filterFavourites);
eleventyConfig.addFilter("formatDate", formatDate);
eleventyConfig.addFilter("isOld", isOld);
diff --git a/src/_includes/layouts/book.html b/src/_includes/layouts/book.html
index cb4eb16..bb075f8 100644
--- a/src/_includes/layouts/book.html
+++ b/src/_includes/layouts/book.html
@@ -4,43 +4,46 @@ layout: "layouts/base"
{% from "macros/date.njk" import format %}
{% from "macros/utils.njk" import stars %}
-
- {% include "svgs/arrow-left.svg" %}
-Back to books
- {{ pullquote }}{{ title }}
+ {% if pullquote %}
+
- ca. {{ year }} -
- {% endif %} -{{ pullquote }}
+- Directed by{{ director }} -
- {% endif %} - {% if watchHistory %}{{ format(watchHistory | last) }}
{% endif %} - {% if rating %}{{ stars(rating) }}{% endif %} - -{{ pullquote }}
@@ -55,8 +22,42 @@ Back to watching
{% endif %} {% if content %} -{{ pullquote }}
++ {% include "svgs/star.svg" %} + This is one of my favourite shows! +
+{% endif %} +- {% include "svgs/circle-info.svg" %} - I've seen this movie {{ watchHistory.length }} {{ "time" | pluralize(watchHistory) }}! -
-{% endif %} -{% if favourite %} -- {% include "svgs/star.svg" %} - This is one of my favourite movies! -
-{% endif %} -{% if content %} -A collection of my favourite books!
+ {{ grid(data) }} +A collection of games I've read over the years.
-A collection of books I've read over the years. I hope one day its an exhaustive list.
+A collection of books I've read.
+ {{ grid(data) }} +Tagged with "{{ tag }}"
+- A collection of games I've read in {{ year.value }}. -
- {{ grid(booksData) }} -A collection of my thoughts on various forms of media that I consume.
-{% include "partials/catalogue-types.html" %} -{% set itemsByYear = collections.catalogue | reverse | organizeByDate %} -{% set years = itemsByYear | keys | sort("desc") %} -A collection of my favourite games!
+ {{ grid(data) }} +A collection of games I played over the years.
-+ A collection of games I played over the years. Ideally this would include every game I've every played, but realistically it's an approximation. I try to include my own thoughts with each. +
+A collection of games I've played.
+ {{ grid(data) }} +- A collection of games I played in {{ year.value }}. -
- {{ grid(gamesData) }} -A collection of my favourite movies!
diff --git a/src/pages/watching/favourites/shows.html b/src/pages/watching/favourites/shows.html index 416c06a..6d15a08 100644 --- a/src/pages/watching/favourites/shows.html +++ b/src/pages/watching/favourites/shows.html @@ -1,12 +1,10 @@ --- +title: Favourite shows permalink: "watching/favourites/shows/index.html" --- {% from "macros/media-grid.njk" import grid %} {% set data = collections.tv | filterFavourites | reverse %} - - {% include "svgs/arrow-left.svg" %} -Back to watchingA collection of my favourite shows!
diff --git a/src/pages/watching/index.html b/src/pages/watching/index.html index b90c5b4..5efcf71 100644 --- a/src/pages/watching/index.html +++ b/src/pages/watching/index.html @@ -1,4 +1,5 @@ --- +title: Watching permalink: "watching/index.html" --- @@ -7,16 +8,15 @@ permalink: "watching/index.html" {% set shows = collections.tv | reverse | limit(5) %} {% set favouriteMovies = collections.movie | filterFavourites | reverse | limit(5) %} {% set favouriteShows = collections.tv | filterFavourites | reverse | limit(5) %} -{% set yearsData = collections.moviesByYear | values | reverse %}A collection of movies and shows I've seen.
+A collection of movies and shows I've seen. I tend to watch more movies than shows these days.
A collection of movies I've seen recently.
{{ grid(data) }}A collection of shows I've seen recently.
{{ grid(data) }}