From 87e6a4d48ded4d969d7d4b2c2cb77604e3ec2b91 Mon Sep 17 00:00:00 2001 From: Doge Date: Thu, 13 May 2021 22:22:10 +0800 Subject: Add Apple podcast categories support --- scripts/feed.js | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/feed.js b/scripts/feed.js index 7c394bd..c64dcb7 100644 --- a/scripts/feed.js +++ b/scripts/feed.js @@ -11,6 +11,24 @@ hexo.extend.generator.register("feed", (locals) => { const podcast = require("podcast"); + // Generate Podcast Categories content + let categories = []; + Object.keys(theme.rss.config.category).forEach((key) => { + const category = { + text: key, + subcats: [] + }; + const subcats = theme.rss.config.category[key]; + subcats.forEach((subcat) => { + category.subcats.push({ + text: subcat + }); + }); + categories.push(category); + }); + + console.log(categories); + // Render for site config const feed = new podcast({ title: config.title, @@ -23,7 +41,7 @@ hexo.extend.generator.register("feed", (locals) => { itunesSummary: config.description, itunesAuthor: config.author, itunesExplicit: theme.rss.config.explicit, - itunesCategory: theme.rss.config.category, + itunesCategory: categories, itunesOwner: { name: config.author, email: theme.rss.config.email -- cgit v1.2.3