diff --git a/config/filters/index.js b/config/filters/index.js index 01f1abb0..bbf08906 100644 --- a/config/filters/index.js +++ b/config/filters/index.js @@ -141,7 +141,6 @@ export default { // feeds normalizeEntries: (entries) => { const posts = [] - if (!entries) return posts entries.forEach((entry) => { const dateKey = Object.keys(entry).find((key) => key.includes('date')) const date = new Date(entry[dateKey]) diff --git a/src/_data/weeklyArtistChart.js b/src/_data/weeklyArtistChart.js index ac734307..92991dd6 100644 --- a/src/_data/weeklyArtistChart.js +++ b/src/_data/weeklyArtistChart.js @@ -37,9 +37,6 @@ const formatData = (data) => { export default async function() { try { const now = DateTime.now() - - if (now.weekday !== 1) return // only run on monday - const startOfWeek = now.minus({ days: now.weekday + 1 }).startOf('day') const endOfWeek = now.minus({ days: now.weekday - 7 }).endOf('day') const startOfWeekSeconds = startOfWeek.toSeconds() @@ -52,6 +49,16 @@ export default async function() { .order('date', { ascending: false }) .limit(10); + if (now.weekday !== 1) return recentCharts.map(chart => { + const formattedData = formatData(JSON.parse(chart['data'])) + return { + title: formattedData['content'], + description: formattedData['description'], + url: `https://coryd.dev/now?ts=${chart['week']}#artists`, + date: chart['date'] + } + }) + if (recentCharts.some(chart => chart['week'] === weekNumber)) { return recentCharts.map(chart => { const formattedData = formatData(JSON.parse(chart['data']))