From ad5c100803d71499947be8b158bf792d29e1261c Mon Sep 17 00:00:00 2001 From: Billyyyyy3320 Date: Wed, 22 Jan 2020 12:00:31 +0800 Subject: [PATCH] feat: deprecate modifyBlogPluginOptions (#57) --- index.js | 76 +++++++++++++++++++++++++------------------------------- 1 file changed, 34 insertions(+), 42 deletions(-) diff --git a/index.js b/index.js index 3f7e47e..395869f 100644 --- a/index.js +++ b/index.js @@ -48,51 +48,43 @@ module.exports = themeConfig => { }, } - const { modifyBlogPluginOptions } = themeConfig - - let blogPluginOptions - - if (typeof modifyBlogPluginOptions === 'function') { - blogPluginOptions = modifyBlogPluginOptions(defaultBlogPluginOptions) - } else { - let resolvedFeedOptions - const isFeedEnabled = themeConfig.feed && themeConfig.feed.canonical_base - if (isFeedEnabled) { - const { - rss = true, - atom = false, - json = false, - ...feedOptions - } = themeConfig.feed - resolvedFeedOptions = Object.assign({}, feedOptions, { - feeds: { - rss2: { enable: rss }, - atom1: { enable: atom }, - json1: { enable: json }, - }, - }) - } - - const properties = [ - 'directories', - 'frontmatters', - 'globalPagination', - 'sitemap', - 'comment', - 'newsletter', - ] - const themeConfigPluginOptions = { - ...pick(themeConfig, properties), - feed: resolvedFeedOptions, - } + let resolvedFeedOptions + const isFeedEnabled = themeConfig.feed && themeConfig.feed.canonical_base + if (isFeedEnabled) { + const { + rss = true, + atom = false, + json = false, + ...feedOptions + } = themeConfig.feed + resolvedFeedOptions = Object.assign({}, feedOptions, { + feeds: { + rss2: { enable: rss }, + atom1: { enable: atom }, + json1: { enable: json }, + }, + }) + } - blogPluginOptions = Object.assign( - {}, - defaultBlogPluginOptions, - themeConfigPluginOptions - ) + const properties = [ + 'directories', + 'frontmatters', + 'globalPagination', + 'sitemap', + 'comment', + 'newsletter', + ] + const themeConfigPluginOptions = { + ...pick(themeConfig, properties), + feed: resolvedFeedOptions, } + const blogPluginOptions = Object.assign( + {}, + defaultBlogPluginOptions, + themeConfigPluginOptions + ) + /** * Integrate plugins */