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:
@@ -44,7 +44,7 @@ class PodcastFeed {
|
|||||||
},
|
},
|
||||||
itunesExplicit: data.itunes?.explicit || false,
|
itunesExplicit: data.itunes?.explicit || false,
|
||||||
itunesCategory: [],
|
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)
|
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
|
guid: episode.url, // optional - defaults to url
|
||||||
date: episode.data.date, // any format that js Date can parse.
|
date: episode.data.date, // any format that js Date can parse.
|
||||||
enclosure : {url:`${episode.data.podcast.enclosureUrl}`}, // optional enclosure
|
enclosure : {url:`${episode.data.podcast.enclosureUrl}`}, // optional enclosure
|
||||||
customElements: []
|
customElements: [],
|
||||||
|
itunesSeason: episode.data.season,
|
||||||
|
itunesEpisode: episode.data.episode
|
||||||
// itunesDuration: duration,
|
// itunesDuration: duration,
|
||||||
}
|
}
|
||||||
if (episode.data.podcast.transcriptUrl) {
|
if (episode.data.podcast.transcriptUrl) {
|
||||||
@@ -69,6 +71,14 @@ class PodcastFeed {
|
|||||||
language:"en-us"
|
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()
|
console.log()
|
||||||
}
|
}
|
||||||
item = feed.addItem(item);
|
item = feed.addItem(item);
|
||||||
|
|||||||
Reference in New Issue
Block a user