🛠 Add various category

This commit is contained in:
Dennis Reimann
2020-10-05 17:04:39 +02:00
parent 583dc71677
commit 8fdf5764ea
4 changed files with 15 additions and 11 deletions

View File

@@ -12,12 +12,13 @@ const slugify = str => str.toLowerCase()
const parseInfo = e => {
const titleMatch = e.title.match(/([\w\s]+?)?\s?#(\d+) - (.*)/)
const [, categoryName = 'News', number, titlePlain] = titleMatch ? titleMatch : [,,,e.title]
let [, categoryName = 'News', number, titlePlain] = titleMatch ? titleMatch : [,,,e.title]
if (!number) categoryName = 'Verschiedenes'
const blockMatch = e.contentSnippet.match(/Blockzeit\s(\d+)/)
const block = blockMatch ? parseInt(blockMatch[1]) : null
const category = slugify(categoryName)
const slug = slugify(`${categoryName} ${number} ${titlePlain}`)
const slug = slugify(`${categoryName} ${number || ''} ${titlePlain}`)
return { block, category, categoryName, number, titlePlain, slug }
}

View File

@@ -27,5 +27,5 @@ renderPage('category', 'podcast/news', { navCurrent: 'podcast', categoryName: 'N
renderPage('category', 'podcast/interviews', { navCurrent: 'podcast', categoryName: 'Interviews', episodes: episodes.filter(e => e.category === 'interview') })
renderPage('category', 'podcast/lesestunde', { navCurrent: 'podcast', categoryName: 'Lesestunde', episodes: episodes.filter(e => e.category === 'lesestunde') })
renderPage('category', 'podcast/der-weg', { navCurrent: 'podcast', categoryName: 'Der Weg', episodes: episodes.filter(e => e.category === 'der-weg') })
renderPage('category', 'podcast/verschiedenes', { navCurrent: 'podcast', categoryName: 'Verschiedenes', episodes: episodes.filter(e => e.category === 'verschiedenes') })
episodes.forEach(episode => renderPage('episode', `podcast/${episode.slug}`, { navCurrent: 'podcast', episode }))