feat: enhance podcast feed metadata with season and episode details

- Add `itunesSeason` and `itunesEpisode` fields to podcast feed items for iTunes compatibility.
- Include custom elements `podcast:season` and `podcast:episode` for additional podcast metadata.
- Fix minor formatting issues in `itunesImage` declaration.
- Ensure metadata for transcripts, season, and episode numbers is properly included in the feed.
This commit is contained in:
2024-12-31 17:55:30 -06:00
parent f27ed079c8
commit 95f2929814

View File

@@ -44,7 +44,7 @@ class PodcastFeed {
},
itunesExplicit: data.itunes?.explicit || false,
itunesCategory: [],
itunesImage: data.itunes?.image || data.site.imageUrl || `${data.site.url}${data.page.filePathStem}.jpg`
itunesImage: data.itunes?.image || data.site.imageUrl || `${data.site.url}${data.page.filePathStem}.jpg`,
});
const items = data.collections[data.episodeCollection]?.filter(episode=>episode.data.podcast!=false)
@@ -59,7 +59,9 @@ class PodcastFeed {
guid: episode.url, // optional - defaults to url
date: episode.data.date, // any format that js Date can parse.
enclosure : {url:`${episode.data.podcast.enclosureUrl}`}, // optional enclosure
customElements: []
customElements: [],
itunesSeason: episode.data.season,
itunesEpisode: episode.data.episode
// itunesDuration: duration,
}
if (episode.data.podcast.transcriptUrl) {
@@ -69,6 +71,14 @@ class PodcastFeed {
language:"en-us"
}}
})
if (episode.data.season && episode.data.episode) {
item.customElements.push({
'podcast:season': episode.data.season,
})
item.customElements.push({
'podcast:episode': episode.data.episode,
})
}
console.log()
}
item = feed.addItem(item);