diff options
author | Doge <[email protected]> | 2021-05-13 22:22:10 +0800 |
---|---|---|
committer | Doge <[email protected]> | 2021-05-13 22:22:10 +0800 |
commit | 87e6a4d48ded4d969d7d4b2c2cb77604e3ec2b91 (patch) | |
tree | 6d563cebb8f236d3f2ccbd8b3ac2ddc03a7d690b | |
parent | b1caf481e325aad09392f771a4bee6c589c380f0 (diff) | |
download | chromate-87e6a4d48ded4d969d7d4b2c2cb77604e3ec2b91.tar.gz chromate-87e6a4d48ded4d969d7d4b2c2cb77604e3ec2b91.tar.bz2 chromate-87e6a4d48ded4d969d7d4b2c2cb77604e3ec2b91.zip |
Add Apple podcast categories support
-rw-r--r-- | _config.yml | 5 | ||||
-rw-r--r-- | 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: '[email protected]' - 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 |