mirror of
https://github.com/Einundzwanzig-Podcast/einundzwanzig.space.git
synced 2025-12-13 16:26:50 +00:00
🛠 Podcast eepisode pages
This commit is contained in:
@@ -1,7 +1,6 @@
|
|||||||
// initialize markdown rendering
|
// initialize markdown rendering
|
||||||
const renderMarkdown = require('./markdown')
|
const renderMarkdown = require('./markdown')
|
||||||
|
|
||||||
const slugify = str => str.toLowerCase().replace(/\W/, '-')
|
|
||||||
const random = max => Math.floor(Math.random() * Math.floor(max))
|
const random = max => Math.floor(Math.random() * Math.floor(max))
|
||||||
const shuffle = arr => { for (let i = arr.length - 1; i > 0; i--) { const j = Math.floor(Math.random() * i); const temp = arr[i]; arr[i] = arr[j]; arr[j] = temp; }; return arr }
|
const shuffle = arr => { for (let i = arr.length - 1; i > 0; i--) { const j = Math.floor(Math.random() * i); const temp = arr[i]; arr[i] = arr[j]; arr[j] = temp; }; return arr }
|
||||||
const formatDate = date => (new Date(date)).toISOString().replace(/T.*/, '').split('-').reverse().join('.')
|
const formatDate = date => (new Date(date)).toISOString().replace(/T.*/, '').split('-').reverse().join('.')
|
||||||
@@ -19,7 +18,6 @@ module.exports = {
|
|||||||
basedir: './src/includes',
|
basedir: './src/includes',
|
||||||
random,
|
random,
|
||||||
shuffle,
|
shuffle,
|
||||||
slugify,
|
|
||||||
assetUrl,
|
assetUrl,
|
||||||
assetPath,
|
assetPath,
|
||||||
formatDate,
|
formatDate,
|
||||||
|
|||||||
@@ -26,12 +26,13 @@
|
|||||||
& h2 {
|
& h2 {
|
||||||
margin-bottom: var(--space-l);
|
margin-bottom: var(--space-l);
|
||||||
color: var(--color-secondary);
|
color: var(--color-secondary);
|
||||||
|
max-width: 20em;
|
||||||
}
|
}
|
||||||
|
|
||||||
& .centered {
|
& .centered {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
margin-left: auto;
|
margin-left: auto;
|
||||||
margin-righht: auto;
|
margin-right: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
& .lead {
|
& .lead {
|
||||||
|
|||||||
@@ -33,6 +33,12 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#episode {
|
||||||
|
& .player {
|
||||||
|
margin-bottom: var(--space-xxl);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.episodes {
|
.episodes {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-gap: var(--space-xl);
|
grid-gap: var(--space-xl);
|
||||||
@@ -107,7 +113,6 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.player {
|
.player {
|
||||||
margin: 0 auto;
|
|
||||||
border-radius: var(--space-m);
|
border-radius: var(--space-m);
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
min-width: 300px;
|
min-width: 300px;
|
||||||
|
|||||||
10
src/episode.pug
Normal file
10
src/episode.pug
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
extends /template.pug
|
||||||
|
|
||||||
|
block main
|
||||||
|
section#episode
|
||||||
|
h1= episode.titlePlain
|
||||||
|
|
||||||
|
+episodePlayer(episode)
|
||||||
|
|
||||||
|
.content
|
||||||
|
!=episode.content
|
||||||
@@ -4,7 +4,7 @@ mixin sprite(id)
|
|||||||
|
|
||||||
mixin episodeItem(e)
|
mixin episodeItem(e)
|
||||||
article.episodeItem&attributes(attributes)
|
article.episodeItem&attributes(attributes)
|
||||||
a.plain(href=e.anchor)
|
a.plain(href=`/podcast/${e.slug}`)
|
||||||
.media
|
.media
|
||||||
img(src=e.image alt=e.title loading="lazy")
|
img(src=e.image alt=e.title loading="lazy")
|
||||||
.content
|
.content
|
||||||
@@ -35,8 +35,9 @@ mixin episodePlayer(e)
|
|||||||
.player__controls
|
.player__controls
|
||||||
.player__button.amplitude-play-pause(data-amplitude-main-play-pause="true" id="play-pause")
|
.player__button.amplitude-play-pause(data-amplitude-main-play-pause="true" id="play-pause")
|
||||||
.player__info
|
.player__info
|
||||||
.player__album(data-amplitude-song-info="album" data-amplitude-main-song-info="true")
|
a.plain(href=`/podcast/${e.slug}`)
|
||||||
.player__name(data-amplitude-song-info="name" data-amplitude-main-song-info="true")
|
.player__album(data-amplitude-song-info="album" data-amplitude-main-song-info="true")
|
||||||
|
.player__name(data-amplitude-song-info="name" data-amplitude-main-song-info="true")
|
||||||
|
|
||||||
script.
|
script.
|
||||||
window.Einundzwanzig = {
|
window.Einundzwanzig = {
|
||||||
@@ -52,13 +53,3 @@ mixin episodePlayer(e)
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
mixin episodeDetails(e)
|
|
||||||
article.episodeDetails&attributes(attributes)
|
|
||||||
.media
|
|
||||||
a(href=e.anchor)
|
|
||||||
img(src=e.image alt=e.title loading="lazy")
|
|
||||||
.content
|
|
||||||
h3: a(href=e.anchor)=e.title
|
|
||||||
p=formatDate(e.date)
|
|
||||||
!=e.content
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ block main
|
|||||||
|
|
||||||
section#podcast
|
section#podcast
|
||||||
.lead.centered
|
.lead.centered
|
||||||
h1 Podcast
|
h1.centered Podcast
|
||||||
:markdown-it(html linkify typographer)
|
:markdown-it(html linkify typographer)
|
||||||
Du findest uns auf
|
Du findest uns auf
|
||||||
[Spotify](https://open.spotify.com/show/10408JFbE1n8MexfrBv33r),
|
[Spotify](https://open.spotify.com/show/10408JFbE1n8MexfrBv33r),
|
||||||
@@ -15,7 +15,7 @@ block main
|
|||||||
a.button(href="https://anchor.fm/s/d8d3c38/podcast/rss") Abonnieren / RSS
|
a.button(href="https://anchor.fm/s/d8d3c38/podcast/rss") Abonnieren / RSS
|
||||||
|
|
||||||
.centered
|
.centered
|
||||||
h2 Kategorien
|
h2.centered Kategorien
|
||||||
ul.categories
|
ul.categories
|
||||||
li: a(href="/podcast/news") News
|
li: a(href="/podcast/news") News
|
||||||
li: a(href="/podcast/interviews") Interviews
|
li: a(href="/podcast/interviews") Interviews
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ extends /template.pug
|
|||||||
|
|
||||||
block main
|
block main
|
||||||
section#team
|
section#team
|
||||||
h1 Team
|
h1.centered Team
|
||||||
ul.members(data-shuffle)
|
ul.members(data-shuffle)
|
||||||
each m in shuffle(team)
|
each m in shuffle(team)
|
||||||
li.member
|
li.member
|
||||||
|
|||||||
@@ -4,15 +4,22 @@ const Parser = require('rss-parser')
|
|||||||
|
|
||||||
const dir = resolve(__dirname, '..', 'generated')
|
const dir = resolve(__dirname, '..', 'generated')
|
||||||
const write = (name, data) => writeFileSync(join(dir, `${name}.json`), JSON.stringify(data, null, 2))
|
const write = (name, data) => writeFileSync(join(dir, `${name}.json`), JSON.stringify(data, null, 2))
|
||||||
|
|
||||||
|
const slugify = str => str.toLowerCase()
|
||||||
|
.replace('ä', 'ae').replace('ö', 'oe').replace('ü', 'ue')
|
||||||
|
.replace(/\s+/g, '-').replace(/[^\w\-]+/g, '')
|
||||||
|
.replace(/\-\-+/g, '-').replace(/^-+/, '').replace(/-+$/, '')
|
||||||
|
|
||||||
const parseInfo = e => {
|
const parseInfo = e => {
|
||||||
const titleMatch = e.title.match(/([\w\s]+?)?\s?#(\d+) - (.*)/)
|
const titleMatch = e.title.match(/([\w\s]+?)?\s?#(\d+) - (.*)/)
|
||||||
const [, categoryName = 'News', number, titlePlain] = titleMatch ? titleMatch : [,,,e.title]
|
const [, categoryName = 'News', number, titlePlain] = titleMatch ? titleMatch : [,,,e.title]
|
||||||
|
|
||||||
const blockMatch = e.contentSnippet.match(/Blockzeit\s(\d+)/)
|
const blockMatch = e.contentSnippet.match(/Blockzeit\s(\d+)/)
|
||||||
const block = blockMatch ? parseInt(blockMatch[1]) : null
|
const block = blockMatch ? parseInt(blockMatch[1]) : null
|
||||||
const category = categoryName.toLowerCase().replace(/\W/, '-')
|
const category = slugify(categoryName)
|
||||||
|
const slug = slugify(`${categoryName} ${number} ${titlePlain}`)
|
||||||
|
|
||||||
return { block, category, categoryName, number, titlePlain }
|
return { block, category, categoryName, number, titlePlain, slug }
|
||||||
}
|
}
|
||||||
|
|
||||||
;(async () => {
|
;(async () => {
|
||||||
|
|||||||
@@ -27,3 +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/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/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/der-weg', { navCurrent: 'podcast', categoryName: 'Der Weg', episodes: episodes.filter(e => e.category === 'der-weg') })
|
||||||
|
|
||||||
|
episodes.forEach(episode => renderPage('episode', `podcast/${episode.slug}`, { navCurrent: 'podcast', episode }))
|
||||||
|
|||||||
Reference in New Issue
Block a user