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 --- _config.yml | 5 ++++- scripts/feed.js | 20 +++++++++++++++++++- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/_config.yml b/_config.yml index 3d16dc3..78c6e3a 100644 --- a/_config.yml +++ b/_config.yml @@ -23,5 +23,8 @@ rss: path: '/feed.rss' config: email: 'privet@utc3.live' - category: 'Education' + category: { + 'Education': ['How To', 'Language Learning'], + 'Technology': [] + } explicit: false \ No newline at end of file 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