feat: add concerts to all feed
This commit is contained in:
parent
757b3273bb
commit
ded6093fd6
5 changed files with 17 additions and 6 deletions
|
@ -46,7 +46,7 @@ export const processContent = (collection) => {
|
|||
let id = 0
|
||||
const collectionData = collection.getAll()[0]
|
||||
const { data } = collectionData
|
||||
const { posts, links, movies, books, pages, artists, genres, tv } = data
|
||||
const { posts, links, movies, books, pages, artists, genres, tv, concerts } = data
|
||||
|
||||
const parseDate = (date) => {
|
||||
if (!date) return null
|
||||
|
@ -104,6 +104,7 @@ export const processContent = (collection) => {
|
|||
items.forEach((item) => {
|
||||
let attribution
|
||||
|
||||
// link attribution if properties exist
|
||||
if (item?.['authors']?.['mastodon']) {
|
||||
const mastoUrl = new URL(item['authors']['mastodon'])
|
||||
attribution = `${mastoUrl.pathname.replace('/', '')}@${mastoUrl.host}`
|
||||
|
@ -115,10 +116,19 @@ export const processContent = (collection) => {
|
|||
url: `${BASE_URL}${item['url']}`,
|
||||
title: `${icon}: ${getTitle(item)}${attribution ? ' via ' + attribution : ''}${item?.['tags']?.length > 0 ? ' ' + tagsToHashtags(item['tags']) : ''}`
|
||||
}
|
||||
|
||||
// set url for link posts
|
||||
if (item?.['link']) content['url'] = item?.['link']
|
||||
|
||||
// set url for posts - identified as slugs here
|
||||
if (item?.['slug']) content['url'] = new URL(item['slug'], BASE_URL).toString()
|
||||
|
||||
// link to artist concerts section if available - artistUrl is only present on concert objects here
|
||||
if (item?.['artistUrl']) content['url'] = `${item['artistUrl']}#concerts`
|
||||
if (item?.['description']) {
|
||||
content['description'] = `${item['description'].split(' ').slice(0, 25).join(' ')}...<br/><br/>`
|
||||
} else if (item?.['notes']) {
|
||||
content['notes'] = `${item['notes'].split(' ').slice(0, 25).join(' ')}...<br/><br/>`
|
||||
} else {
|
||||
content['description'] = ''
|
||||
}
|
||||
|
@ -140,6 +150,7 @@ export const processContent = (collection) => {
|
|||
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['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)
|
||||
|
|
Reference in a new issue