mirror of
https://github.com/Einundzwanzig-Podcast/einundzwanzig.space.git
synced 2025-12-13 16:26:50 +00:00
🛠 Add various category
This commit is contained in:
@@ -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 }
|
||||
}
|
||||
|
||||
@@ -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 }))
|
||||
|
||||
Reference in New Issue
Block a user