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 -
+
+ {{ format(page.date) }} +

{{ title }}

+ {% if pullquote %}

{{ pullquote }}

{% endif %} +
+{% if content %} +
+ {{ content | safe }} +
+{% endif %} +
+
-{% if content %} -
-
- {{ content | safe }} -
-{% endif %} -{{ format(page.date) }} + +
+ diff --git a/src/_includes/layouts/catalogue-item.html b/src/_includes/layouts/catalogue-item.html deleted file mode 100644 index ee51519..0000000 --- a/src/_includes/layouts/catalogue-item.html +++ /dev/null @@ -1,53 +0,0 @@ ---- -layout: "layouts/base" -imageAlt: "" -imageCaption: "" ---- - -{% set filteredTags = tags | filterCatalogueTags %} -{% from "macros/date.njk" import format %} -{% from "macros/utils.njk" import stars %} -
-
- {{ format(page.date) }} -

{{ title }}

- {% if subtitle %}

{{ subtitle }}

{% endif %} - {% if rating %}
{{ stars(rating) }}
{% endif %} - {% if tertiary or year %} -
- {% if tertiary %}
{{ tertiary | safe }}
{% endif %} - {% if year %} -

- ca. {{ year }} -

- {% endif %} -
- {% endif %} - {% if filteredTags | length > 0 %} - - {% endif %} -
- {% if image %} -
- {{ imageAlt }} -
- {% endif %} - {{ content | safe }} - {% if url %} - - {% include "svgs/link.svg" %} - {{ linkTitle }} - - {% endif %} -
diff --git a/src/_includes/layouts/game.html b/src/_includes/layouts/game.html index bcaeec7..f97eb81 100644 --- a/src/_includes/layouts/game.html +++ b/src/_includes/layouts/game.html @@ -4,10 +4,18 @@ layout: "layouts/base" {% from "macros/date.njk" import format %} {% from "macros/utils.njk" import stars %} - - {% include "svgs/arrow-left.svg" %} -Back to games -
+
+ {{ format(page.date) }} +

{{ title }}

+

{{ pullquote }}

+
+{% if content %} +
+ {{ content | safe }} +
+{% endif %} +
+
-{% if content %} -
-
- {{ content | safe }} -
-{% endif %} -{{ format(page.date) }} + diff --git a/src/_includes/layouts/movie.html b/src/_includes/layouts/movie.html index 26ceb60..860c40a 100644 --- a/src/_includes/layouts/movie.html +++ b/src/_includes/layouts/movie.html @@ -4,43 +4,10 @@ layout: "layouts/base" {% from "macros/date.njk" import format %} {% from "macros/utils.njk" import stars %} - - {% include "svgs/arrow-left.svg" %} -Back to watching -
-
- -
-
-
-

{{ title }}

-
- {% if subtitle %}

{{ subtitle }}

{% endif %} - {% if director %} -

- Directed by{{ director }} -

- {% endif %} - {% if watchHistory %}

{{ format(watchHistory | last) }}

{% endif %} - {% if rating %}{{ stars(rating) }}{% endif %} - -
+
+ {{ format(page.date) }} +

{{ title }}

+

{{ pullquote }}

{% if watchHistory.length > 1 %}

@@ -55,8 +22,42 @@ Back to watching

{% endif %} {% if content %} -
{{ content | safe }}
{% endif %} +
+ diff --git a/src/_includes/layouts/show.html b/src/_includes/layouts/show.html index 6d0e25b..49e40e3 100644 --- a/src/_includes/layouts/show.html +++ b/src/_includes/layouts/show.html @@ -4,10 +4,24 @@ layout: "layouts/base" {% from "macros/date.njk" import format %} {% from "macros/utils.njk" import stars %} - - {% include "svgs/arrow-left.svg" %} -Back to watching -
+
+ {{ format(page.date) }} +

{{ title }}

+

{{ pullquote }}

+
+{% if content %} +
+ {{ content | safe }} +
+{% endif %} +{% if favourite or isFavourite %} +

+ {% include "svgs/star.svg" %} + This is one of my favourite shows! +

+{% endif %} +
+
@@ -41,22 +55,4 @@ Back to watching {% endif %} -
-{% if watchHistory.length > 1 %} -

- {% 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 %} -
-
- {{ content | safe }} -
-{% endif %} + diff --git a/src/catalogue/comics/comics.11tydata.js b/src/catalogue/comics/comics.11tydata.js index ddaaf35..e5d53bf 100644 --- a/src/catalogue/comics/comics.11tydata.js +++ b/src/catalogue/comics/comics.11tydata.js @@ -1,5 +1,4 @@ export default { - layout: "layouts/catalogue-item", tags: "comic", permalink: "catalogue/comics/{{ page.fileSlug }}/index.html", eleventyComputed: { diff --git a/src/catalogue/podcasts/podcasts.11tydata.js b/src/catalogue/podcasts/podcasts.11tydata.js index 2c7819b..ee1e405 100644 --- a/src/catalogue/podcasts/podcasts.11tydata.js +++ b/src/catalogue/podcasts/podcasts.11tydata.js @@ -1,5 +1,4 @@ export default { - layout: "layouts/catalogue-item", tags: "podcast", permalink: "catalogue/podcasts/{{ page.fileSlug }}/index.html", linkTitle: "Listen to the podcast", diff --git a/src/css/blocks/pill.css b/src/css/blocks/pill.css index b88d38e..e549622 100644 --- a/src/css/blocks/pill.css +++ b/src/css/blocks/pill.css @@ -4,6 +4,8 @@ background-color: var(--color-surface); color: var(--color-fadeText); font-size: 0.8rem; + font-family: var(--font-family-body); + font-weight: var(--font-weight-body-regular); line-height: 0.8rem; padding-inline: var(--spacing-0\.5); padding-block: var(--spacing-0\.25); diff --git a/src/css/blocks/stars.css b/src/css/blocks/stars.css index 495a56b..8353732 100644 --- a/src/css/blocks/stars.css +++ b/src/css/blocks/stars.css @@ -1,11 +1,12 @@ .stars li { line-height: 16px; /* Size of icons */ + filter: drop-shadow(-1px 1px 0px var(--color-surface)); transition: margin ease-in-out var(--transition-duration); + z-index: 1; } .star-filled { color: var(--color-primary); - z-index: 1; } .star-empty { diff --git a/src/games/2012-02-26-yoshis-island.md b/src/games/2012-02-26-yoshis-island.md index 3a07613..e059eb8 100644 --- a/src/games/2012-02-26-yoshis-island.md +++ b/src/games/2012-02-26-yoshis-island.md @@ -3,6 +3,7 @@ title: "Super Mario World 2: Yoshi's Island" platform: Super Nintendo image: https://cdn.wonderfulfrog.com/images/Yoshis_Island_box_art.jpg tags: ["platformer"] +isFavourite: true year: 1995 --- diff --git a/src/pages/books/favourites.html b/src/pages/books/favourites.html new file mode 100644 index 0000000..b4e9418 --- /dev/null +++ b/src/pages/books/favourites.html @@ -0,0 +1,15 @@ +--- +title: Favourite books +permalink: "books/favourites/index.html" +--- + +{% from "macros/media-grid.njk" import grid %} +{% set data = collections.book | filterFavourites | reverse %} + + {% include "svgs/arrow-left.svg" %} +Back to books +
+

Favourite book

+

A collection of my favourite books!

+ {{ grid(data) }} +
diff --git a/src/pages/books/index.html b/src/pages/books/index.html index 7744ec9..17ed024 100644 --- a/src/pages/books/index.html +++ b/src/pages/books/index.html @@ -1,21 +1,33 @@ --- +title: Books permalink: "books/index.html" --- {% from "macros/media-grid.njk" import grid %} -{% set data = collections.book | reverse %} -{% set yearsData = collections.booksByYear | values | reverse %} +{% set data = collections.book | reverse | limit(5) %} +{% set faves = collections.book | filterFavourites | reverse | limit(5) %} +{% set tags = collections.book | allTagCounts(["book"]) | limit(5) %}

Books

-

A collection of games I've read over the years.

-

Browse by release year

-
diff --git a/src/pages/books/recent.html b/src/pages/books/recent.html new file mode 100644 index 0000000..d3ed8a3 --- /dev/null +++ b/src/pages/books/recent.html @@ -0,0 +1,12 @@ +--- +title: Recent books +permalink: "books/recent/index.html" +--- + +{% from "macros/media-grid.njk" import grid %} +{% set data = collections.book | reverse %} +
+

Recent books

+

A collection of books I've read.

+ {{ grid(data) }} +
diff --git a/src/pages/books/tag.html b/src/pages/books/tag.html new file mode 100644 index 0000000..1223230 --- /dev/null +++ b/src/pages/books/tag.html @@ -0,0 +1,15 @@ +--- +pagination: + data: collections.booksByTag + size: 1 + alias: tag +permalink: "books/tag/{{ tag | slugify }}/index.html" +--- + +{% from "macros/media-grid.njk" import grid %} +{% set data = collections.booksByTag[tag] %} +
+

Books

+

Tagged with "{{ tag }}"

+
+{{ grid(data) }} diff --git a/src/pages/books/tags.html b/src/pages/books/tags.html new file mode 100644 index 0000000..40570a2 --- /dev/null +++ b/src/pages/books/tags.html @@ -0,0 +1,19 @@ +--- +title: Tagged in Books +permalink: "books/tags/index.html" +--- + +{% from "macros/media-grid.njk" import grid %} +{% set tags = collections.book | allTagCounts(["book"]) %} +
+

Tagged in Books

+ +
diff --git a/src/pages/books/year.html b/src/pages/books/year.html deleted file mode 100644 index 76f0143..0000000 --- a/src/pages/books/year.html +++ /dev/null @@ -1,21 +0,0 @@ ---- -pagination: - data: collections.booksByYear - size: 1 - alias: year - resolve: values -permalink: "books/year/{{ year.value }}/index.html" ---- - -{% from "macros/media-grid.njk" import grid %} -{% set booksData = year.data | reverse %} -
- - {% include "svgs/arrow-left.svg" %} - Back to books -

Books in {{ year.value }}

-

- A collection of games I've read in {{ year.value }}. -

- {{ grid(booksData) }} -
diff --git a/src/pages/catalogue-type.html b/src/pages/catalogue-type.html deleted file mode 100644 index 5051722..0000000 --- a/src/pages/catalogue-type.html +++ /dev/null @@ -1,25 +0,0 @@ ---- -pagination: - data: collections.catalogueByType - size: 1 - alias: type - filter: - - catalogue -eleventyExcludeFromCollections: true -permalink: /catalogue/{{ type | pluralize | slugify }}/index.html -eleventyComputed: - title: Catalogue - {{ type | pluralize | capitalize }} - description: My thoughts on various {{ type | pluralize }}. ---- - -{% from "macros/catalogue.njk" import yearList %} -

{{ type | pluralize | capitalize }}

-{% include "partials/catalogue-types.html" %} -{% set itemsByYear = collections.catalogueByType[type] | reverse | organizeByDate %} -{% set years = itemsByYear | keys | sort("desc") %} -
- {% for year in years %} - {% set itemsInYear = itemsByYear[year] %} - {{ yearList(itemsInYear, year, false) }} - {% endfor %} -
diff --git a/src/pages/catalogue.html b/src/pages/catalogue.html deleted file mode 100644 index 58a133c..0000000 --- a/src/pages/catalogue.html +++ /dev/null @@ -1,17 +0,0 @@ ---- -title: Catalogue -description: A collection of media I've consumed in one way or another. ---- - -{% from "macros/catalogue.njk" import yearList %} -

Catalogue

-

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") %} -
- {% for year in years %} - {% set itemsInYear = itemsByYear[year] %} - {{ yearList(itemsInYear, year) }} - {% endfor %} -
diff --git a/src/pages/games/favourites.html b/src/pages/games/favourites.html new file mode 100644 index 0000000..fe7903d --- /dev/null +++ b/src/pages/games/favourites.html @@ -0,0 +1,12 @@ +--- +title: Favourite games +permalink: "games/favourites/index.html" +--- + +{% from "macros/media-grid.njk" import grid %} +{% set data = collections.game | filterFavourites | reverse %} +
+

Favourite games

+

A collection of my favourite games!

+ {{ grid(data) }} +
diff --git a/src/pages/games/index.html b/src/pages/games/index.html index 394472a..1054624 100644 --- a/src/pages/games/index.html +++ b/src/pages/games/index.html @@ -1,21 +1,22 @@ --- +title: Games permalink: "games/index.html" --- {% from "macros/media-grid.njk" import grid %} -{% set gamesData = collections.game | reverse %} -{% set yearsData = collections.gamesByYear | values | reverse %} +{% set data = collections.game | reverse | limit(5) %} +{% set faves = collections.game | filterFavourites | reverse | limit(5) %}

Games

-

A collection of games I played over the years.

-

Browse by release year

- -

Latest games

- {{ grid(gamesData) }} +

+ 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. +

+

+ Latest games +

+ {{ grid(data) }} +

+ Favourite games +

+ {{ grid(faves) }}
diff --git a/src/pages/games/recent.html b/src/pages/games/recent.html new file mode 100644 index 0000000..bd3cda1 --- /dev/null +++ b/src/pages/games/recent.html @@ -0,0 +1,12 @@ +--- +title: Recent games +permalink: "games/recent/index.html" +--- + +{% from "macros/media-grid.njk" import grid %} +{% set data = collections.game | reverse %} +
+

Latest games

+

A collection of games I've played.

+ {{ grid(data) }} +
diff --git a/src/pages/games/year.html b/src/pages/games/year.html deleted file mode 100644 index 0e3770d..0000000 --- a/src/pages/games/year.html +++ /dev/null @@ -1,21 +0,0 @@ ---- -pagination: - data: collections.gamesByYear - size: 1 - alias: year - resolve: values -permalink: "games/year/{{ year.value }}/index.html" ---- - -{% from "macros/media-grid.njk" import grid %} -{% set gamesData = year.data | reverse %} -
- - {% include "svgs/arrow-left.svg" %} - Back to games -

Games in {{ year.value }}

-

- A collection of games I played in {{ year.value }}. -

- {{ grid(gamesData) }} -
diff --git a/src/pages/watching/favourites/movies.html b/src/pages/watching/favourites/movies.html index 06949bb..43c21db 100644 --- a/src/pages/watching/favourites/movies.html +++ b/src/pages/watching/favourites/movies.html @@ -1,12 +1,10 @@ --- +title: Favourite movies permalink: "watching/favourites/movies/index.html" --- {% from "macros/media-grid.njk" import grid %} {% set data = collections.movie | filterFavourites | reverse %} - - {% include "svgs/arrow-left.svg" %} -Back to watching

Favourite movies

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 watching

Favourite shows

A 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 %}

Watching

-

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.

- Latest movies + Recent movies

{{ grid(movies) }}

- Latest shows + Recent shows

{{ grid(shows) }}

diff --git a/src/pages/watching/recent/movies.html b/src/pages/watching/recent/movies.html index 5ccefce..856a9bc 100644 --- a/src/pages/watching/recent/movies.html +++ b/src/pages/watching/recent/movies.html @@ -1,14 +1,12 @@ --- +title: Recent movies permalink: "watching/recent/movies/index.html" --- {% from "macros/media-grid.njk" import grid %} {% set data = collections.movie | reverse %} - - {% include "svgs/arrow-left.svg" %} -Back to watching
-

Recently movies

+

Recent movies

A collection of movies I've seen recently.

{{ grid(data) }}
diff --git a/src/pages/watching/recent/shows.html b/src/pages/watching/recent/shows.html index 3f0c61d..1d5f7e8 100644 --- a/src/pages/watching/recent/shows.html +++ b/src/pages/watching/recent/shows.html @@ -1,14 +1,12 @@ --- +title: Recent shows permalink: "watching/recent/shows/index.html" --- {% from "macros/media-grid.njk" import grid %} {% set data = collections.tv | reverse %} - - {% include "svgs/arrow-left.svg" %} -Back to watching
-

Recently shows

+

Recent shows

A collection of shows I've seen recently.

{{ grid(data) }}