diff --git a/package-lock.json b/package-lock.json index 602cf6fc..c7974c37 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "coryd.dev", - "version": "23.0.1", + "version": "24.0.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "coryd.dev", - "version": "23.0.1", + "version": "24.0.0", "license": "MIT", "dependencies": { "@cdransf/api-text": "^1.5.0", @@ -792,9 +792,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001651", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001651.tgz", - "integrity": "sha512-9Cf+Xv1jJNe1xPZLGuUXLNkE1BoDkqRqYyFJ9TDYSqhduqA4hu4oR9HluGoWYQC/aj8WHjsGVV+bwkh0+tegRg==", + "version": "1.0.30001653", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001653.tgz", + "integrity": "sha512-XGWQVB8wFQ2+9NZwZ10GxTYC5hk0Fa+q8cSkr0tgvMhYhMHP/QC+WTgrePMDBWiWc/pV+1ik82Al20XOK25Gcw==", "dev": true, "funding": [ { diff --git a/package.json b/package.json index e80d6020..ad2dc958 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "coryd.dev", - "version": "23.0.1", + "version": "24.0.0", "description": "The source for my personal site. Built using 11ty (and other tools).", "type": "module", "scripts": { diff --git a/src/assets/styles/base/index.css b/src/assets/styles/base/index.css index 6e2db3ec..4439cedc 100644 --- a/src/assets/styles/base/index.css +++ b/src/assets/styles/base/index.css @@ -141,6 +141,14 @@ p.music { } } +p.posts { + color: var(--posts); + + & svg { + stroke: var(--posts); + } +} + p.tattoo { color: var(--tattoo); diff --git a/src/assets/styles/defaults/vars.css b/src/assets/styles/defaults/vars.css index 7726bb8f..e1b446d5 100644 --- a/src/assets/styles/defaults/vars.css +++ b/src/assets/styles/defaults/vars.css @@ -74,6 +74,7 @@ /* borders */ --border-default: 1px solid var(--accent-color); + --border-gray: 1px solid var(--gray-light); /* fonts */ --font-mono: MonoLisa, Menlo, Consolas, Monaco, Liberation Mono, Lucida Console, ui-monospace, monospace; diff --git a/src/assets/styles/pages/post.css b/src/assets/styles/pages/post.css index c34dbadb..2d06ca4d 100644 --- a/src/assets/styles/pages/post.css +++ b/src/assets/styles/pages/post.css @@ -1,3 +1,15 @@ +article.standalone .associated-media:last-of-type > hr { + display: none; +} + +p + .associated-media, +img + .associated-media, +.banner + .associated-media, +youtube-video + .associated-media { + margin-top: var(--sizing-base); + border-top: var(--border-gray) +} + .footnotes { & .footnotes-list { margin-bottom: 0; @@ -11,6 +23,15 @@ display: inline; } } + + & ~ youtube-video { + margin-top: var(--sizing-base); + } + + & + .associated-media { + margin-top: var(--sizing-base); + border-top: var(--border-gray); + } } sup.footnote-ref { diff --git a/src/data/artists.js b/src/data/artists.js index 976d4e80..db6bac72 100644 --- a/src/data/artists.js +++ b/src/data/artists.js @@ -29,7 +29,8 @@ const fetchAllArtists = async () => { albums, concerts, books, - movies + movies, + posts `) .range(rangeStart, rangeStart + PAGE_SIZE - 1) @@ -82,6 +83,13 @@ const processArtists = (artists) => { tmdb_id: movie['tmdb_id'], url: `/watching/movies/${movie['tmdb_id']}`, })).sort((a, b) => b['year'] - a['year']) : null, + posts: artist['posts']?.[0]?.['id'] ? artist['posts'].map(post => ({ + id: post['id'], + title: post['title'], + date: post['date'], + slug: post['slug'], + url: post['slug'], + })).sort((a, b) => new Date(b['date']) - new Date(a['date'])) : null, })) } diff --git a/src/data/books.js b/src/data/books.js index 9d601387..02bdc23e 100644 --- a/src/data/books.js +++ b/src/data/books.js @@ -32,7 +32,8 @@ const fetchAllBooks = async () => { artists, movies, genres, - shows + shows, + posts `) .order('date_finished', { ascending: false }) .range(rangeStart, rangeStart + PAGE_SIZE - 1) @@ -68,7 +69,7 @@ const processBooks = (books) => { date: book['date_finished'], status: book['read_status'], progress: book['progress'], - tags: Array.isArray(book['tags']) ? book['tags'] : book['tags']?.split(',') || [], // Ensure tags is an array + tags: Array.isArray(book['tags']) ? book['tags'] : book['tags']?.split(',') || [], isbn: book['isbn'], type: 'book', artists: book['artists']?.[0]?.['id'] ? book['artists'].map(artist => { @@ -87,6 +88,13 @@ const processBooks = (books) => { show['url'] = `/watching/shows/${show['tmdb_id']}` return show }).sort((a, b) => b['year'] - a['year']) : null, + posts: book['posts']?.[0]?.['id'] ? book['posts'].map(post => ({ + id: post['id'], + title: post['title'], + date: post['date'], + slug: post['slug'], + url: post['slug'], + })).sort((a, b) => new Date(b['date']) - new Date(a['date'])) : null, year, } }) diff --git a/src/data/genres.js b/src/data/genres.js index 5d5eba4d..293b9001 100644 --- a/src/data/genres.js +++ b/src/data/genres.js @@ -23,7 +23,8 @@ const fetchGenresWithArtists = async () => { favorite ), books, - movies + movies, + posts `) .order('id', { ascending: true }) @@ -52,6 +53,13 @@ const fetchGenresWithArtists = async () => { tmdb_id: movie['tmdb_id'], url: `/watching/movies/${movie['tmdb_id']}`, })).sort((a, b) => b['year'] - a['year']) : null, + posts: genre['posts']?.[0]?.['id'] ? genre['posts'].map(post => ({ + id: post['id'], + title: post['title'], + date: post['date'], + slug: post['slug'], + url: post['slug'], + })).sort((a, b) => new Date(b['date']) - new Date(a['date'])) : null, })) } diff --git a/src/data/movies.js b/src/data/movies.js index f8253ca2..952981f6 100644 --- a/src/data/movies.js +++ b/src/data/movies.js @@ -34,7 +34,8 @@ const fetchAllMovies = async () => { artists, books, genres, - shows + shows, + posts `) .order('last_watched', { ascending: false }) .range(rangeStart, rangeStart + PAGE_SIZE - 1) @@ -88,6 +89,13 @@ const processMovies = (movies) => { show['url'] = `/watching/shows/${show['tmdb_id']}` return show }).sort((a, b) => b['year'] - a['year']) : null, + posts: item['posts']?.[0]?.['id'] ? item['posts'].map(post => ({ + id: post['id'], + title: post['title'], + date: post['date'], + slug: post['slug'], + url: post['slug'], + })).sort((a, b) => new Date(b['date']) - new Date(a['date'])) : null, })) } diff --git a/src/data/posts.js b/src/data/posts.js index 42ef353e..9960fe43 100644 --- a/src/data/posts.js +++ b/src/data/posts.js @@ -1,4 +1,6 @@ import { createClient } from '@supabase/supabase-js' +import slugify from 'slugify' +import { sanitizeMediaString, parseCountryField } from '../../config/utilities/index.js' const SUPABASE_URL = process.env['SUPABASE_URL'] const SUPABASE_KEY = process.env['SUPABASE_KEY'] @@ -92,9 +94,11 @@ const fetchAllPosts = async () => { const processPosts = async (posts, tagsByPostId, blocksByPostId) => { return Promise.all(posts.map(async post => { + // tags post['tags'] = tagsByPostId[post['id']] || [] - const blocks = blocksByPostId[post['id']] || [] + // blocks + const blocks = blocksByPostId[post['id']] || [] post['blocks'] = await Promise.all(blocks.map(async block => { const blockData = await fetchBlockData(block['collection'], block['item']) if (!blockData) return null @@ -105,7 +109,42 @@ const processPosts = async (posts, tagsByPostId, blocksByPostId) => { } })).then(blocks => blocks.filter(block => block !== null)) + // artists + post['artists'] = post['artists']?.[0]?.['id'] ? post['artists'].map(artist => { + artist['url'] = `/music/artists/${sanitizeMediaString(artist['name'])}-${sanitizeMediaString(parseCountryField(artist['country']))}` + return artist + }).sort((a, b) => a['name'].localeCompare(b['name'])) : null + + // books + post['books'] = post['books']?.[0]?.['id'] ? post['books'].map(book => ({ + title: book['title'], + author: book['author'], + isbn: book['isbn'], + description: book['description'], + url: `/books/${book['isbn']}`, + })).sort((a, b) => a['title'].localeCompare(b['title'])) : null + + // movies + post['movies'] = post['movies']?.[0]?.['id'] ? post['movies'].map(movie => { + movie['url'] = `/watching/movies/${movie['tmdb_id']}` + return movie + }).sort((a, b) => b['year'] - a['year']) : null + + // genres + post['genres'] = post['genres']?.[0]?.['id'] ? post['genres'].map(genre => { + genre['url'] = `/music/genres/${slugify(genre['name'].replace('/', '-').toLowerCase())}` + return genre + }).sort((a, b) => a['name'].localeCompare(b['name'])) : null + + // shows + post['shows'] = post['shows']?.[0]?.['id'] ? post['shows'].map(show => { + show['url'] = `/watching/shows/${show['tmdb_id']}` + return show + }).sort((a, b) => b['year'] - a['year']) : null + + // image if (post['image']) post['image'] = post['image']['filename_disk'] + return post })) } diff --git a/src/data/tv.js b/src/data/tv.js index fb5d3da4..3b95e362 100644 --- a/src/data/tv.js +++ b/src/data/tv.js @@ -25,9 +25,11 @@ const fetchAllShows = async () => { review, art, backdrop, + tags, episodes, movies, - books + books, + posts `) .range(rangeStart, rangeStart + PAGE_SIZE - 1) @@ -51,6 +53,7 @@ const prepareShowData = (show) => ({ url: `/watching/shows/${show['tmdb_id']}`, episodes: show['episodes'] || [], tattoo: show['tattoo'], + tags: Array.isArray(show['tags']) ? show['tags'] : show['tags']?.split(',') || [], movies: show['movies']?.[0]?.['id'] ? show['movies'].map(movie => { movie['url'] = `/watching/movies/${movie['tmdb_id']}` return movie @@ -62,6 +65,13 @@ const prepareShowData = (show) => ({ description: book['description'], url: `/books/${book['isbn']}`, })).sort((a, b) => a['title'].localeCompare(b['title'])) : null, + posts: show['posts']?.[0]?.['id'] ? show['posts'].map(post => ({ + id: post['id'], + title: post['title'], + date: post['date'], + slug: post['slug'], + url: post['slug'], + })).sort((a, b) => new Date(b['date']) - new Date(a['date'])) : null, }) const prepareEpisodeData = (show) => show['episodes'].map(episode => ({ diff --git a/src/includes/partials/blocks/associated-media.liquid b/src/includes/partials/blocks/associated-media.liquid index c6ece33a..7ae86991 100644 --- a/src/includes/partials/blocks/associated-media.liquid +++ b/src/includes/partials/blocks/associated-media.liquid @@ -1,65 +1,80 @@ -{% comment %} render related artists {% endcomment %} -{%- if artists -%} -
- {% tablericon "headphones" "Related artist(s)" %} - Related artist(s) -
-- {% tablericon "books" "Related book(s)" %} - Related book(s) -
-- {% tablericon "headphones" "Genre(s)" %} - Related genre(s) -
-- {% tablericon "movie" "Related movie(s)" %} - Related movie(s) -
-- {% tablericon "device-tv-old" "Related show(s)" %} - Related show(s) -
-+ {% tablericon "headphones" "Related artist(s)" %} + Related artist(s) +
++ {% tablericon "books" "Related book(s)" %} + Related book(s) +
++ {% tablericon "headphones" "Genre(s)" %} + Related genre(s) +
++ {% tablericon "movie" "Related movie(s)" %} + Related movie(s) +
++ {% tablericon "article" "Related post(s)" %} + Related post(s) +
++ {% tablericon "device-tv-old" "Related show(s)" %} + Related show(s) +
+My top {{ genre.name }} artists {{ connectingWord }} {{ mediaLinks }}. I've listened to {{ genre.total_plays | formatNumber }} tracks form this genre.