chore: restore data to inform relationships

This commit is contained in:
Cory Dransfeldt 2024-08-26 11:46:59 -07:00
parent 1eeaf860bb
commit 0a9e852b03
No known key found for this signature in database
6 changed files with 11 additions and 9 deletions

View file

@ -65,7 +65,7 @@ export const processContent = (collection) => {
}
}
const movieData = movies['watchHistory'].filter((movie) => movie['rating'])
const movieData = movies['movies'].filter((movie) => movie['rating'])
const bookData = books.all.filter((book) => book['rating'])
const addItemToIndex = (items, icon, getUrl, getTitle, getTags) => {
@ -135,14 +135,14 @@ export const processContent = (collection) => {
addContent(posts, '📝', (item) => item['title'], (item) => item['date'])
addContent(links, '🔗', (item) => item['title'], (item) => item['date'])
addContent(books.all.filter((book) => book['status'] === 'finished'), '📖', (item) => `${item['title']}${item['rating'] ? ' (' + item['rating'] + ')' : ''}`, (item) => item['date'])
addContent(movies['watchHistory'], '🎥', (item) => `${item['title']}${item['rating'] ? ' (' + item['rating'] + ')' : ''}`, (item) => item['lastWatched'])
addContent(movies['movies'], '🎥', (item) => `${item['title']}${item['rating'] ? ' (' + item['rating'] + ')' : ''}`, (item) => item['lastWatched'])
addContent(concerts, '🎤', (item) => `${item['artistNameString'] ? item['artistNameString'] : item['artist']['name']} at ${item['venue']['name'].split(',')[0].trim()}`, (item) => item['date'])
addSiteMapContent(posts, (item) => item.title, (item) => item.date)
addSiteMapContent(pages, (item) => item.title, (item) => item.date)
addSiteMapContent(artists, (item) => item.name, (item) => item.date)
addSiteMapContent(genres, (item) => item.name, (item) => item.date)
addSiteMapContent(movies['watchHistory'], (item) => item.title, (item) => item.date)
addSiteMapContent(movies['movies'], (item) => item.title, (item) => item.date)
addSiteMapContent(books.all, (item) => item.title, (item) => item.date)
addSiteMapContent(tv?.['shows'], (item) => item.title, (item) => item.date)

4
package-lock.json generated
View file

@ -1,12 +1,12 @@
{
"name": "coryd.dev",
"version": "24.1.1",
"version": "24.1.2",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "coryd.dev",
"version": "24.1.1",
"version": "24.1.2",
"license": "MIT",
"dependencies": {
"@cdransf/api-text": "^1.5.0",

View file

@ -1,6 +1,6 @@
{
"name": "coryd.dev",
"version": "24.1.1",
"version": "24.1.2",
"description": "The source for my personal site. Built using 11ty (and other tools).",
"type": "module",
"scripts": {

View file

@ -123,6 +123,6 @@ const sortBooksByYear = (books) => {
export default async function () {
const books = await fetchAllBooks()
const processedBooks = processBooks(books).filter(book => book['status'] !== 'want to read')
const processedBooks = processBooks(books)
return { all: processedBooks, years: sortBooksByYear(processedBooks) }
}

View file

@ -116,6 +116,7 @@ export default async function () {
const recentlyWatchedMovies = filterMovies(movie => movie['lastWatched'] && year - DateTime.fromISO(movie['lastWatched']).year <= 3).sort((a, b) => new Date(b['lastWatched']) - new Date(a['lastWatched']))
return {
movies: formatMovieData(processedMovies),
watchHistory: formatMovieData(filterMovies(movie => movie['lastWatched'])),
recentlyWatched: formatMovieData(recentlyWatchedMovies),
favorites: formatMovieData(favoriteMovies).sort((a, b) => a['title'].localeCompare(b['title'])),
@ -123,6 +124,7 @@ export default async function () {
} catch (error) {
console.error('Error fetching and processing movies data:', error)
return {
movies: [],
watchHistory: [],
recentlyWatched: [],
favorites: [],

View file

@ -1,7 +1,7 @@
---
layout: default
pagination:
data: movies.watchHistory
data: movies.movies
size: 1
alias: movie
permalink: "{{ movie.url }}/index.html"
@ -57,7 +57,7 @@ schema: movie
<hr />
{% endif %}
{% render "partials/blocks/associated-media.liquid", posts:movie.posts %}
{% render "partials/blocks/associated-media.liquid", posts:movie.relatedMovies %}
{% render "partials/blocks/associated-media.liquid", movies:movie.relatedMovies %}
{% render "partials/blocks/associated-media.liquid", shows:movie.shows %}
{% render "partials/blocks/associated-media.liquid", artists:movie.artists %}
{% render "partials/blocks/associated-media.liquid", books:movie.books %}