feat: programmatically generate year book pages

This commit is contained in:
Cory Dransfeldt 2024-07-15 13:52:44 -07:00
parent eed026a6e8
commit b50a4670d2
No known key found for this signature in database
18 changed files with 92 additions and 101 deletions

View file

@ -30,7 +30,7 @@ export const searchIndex = (collection) => {
const { data } = collectionData
const { posts, links, movies, books } = data
const movieData = movies['movies'].filter(movie => (movie['review']?.length && movie['review']?.length > 0 && movie['rating']))
const bookData = books.filter(book => (book['review']?.length && book['review']?.length > 0 && book['rating']))
const bookData = books.all.filter(book => (book['review']?.length && book['review']?.length > 0 && book['rating']))
const addItemToIndex = (items, icon, getUrl, getTitle, getTags) => {
if (items) {
items.forEach((item) => {
@ -104,7 +104,7 @@ export const allContent = (collection) => {
addContent(posts, '📝', item => item['title'], item => item['date'])
addContent(links, '🔗', item => item['title'], item => item['date'])
addContent(books.filter(book => book['status'] === 'finished'), '📖', item => `${item['title']}${item['rating'] ? ' (' + item['rating'] + ')' : ''}`, item => item['date'])
addContent(books.all.filter(book => book['status'] === 'finished'), '📖', item => `${item['title']}${item['rating'] ? ' (' + item['rating'] + ')' : ''}`, item => item['date'])
addContent(movies, '🎥', item => `${item['title']}${item['rating'] ? ' (' + item['rating'] + ')' : ''}`, item => item['lastWatched'])
return aggregateContent.sort((a, b) => {