Skip to content
This repository was archived by the owner on May 13, 2024. It is now read-only.

Commit 4128c3a

Browse files
committed
feat: deprecate modifyBlogPluginOptions (#57)
1 parent 9f99492 commit 4128c3a

File tree

1 file changed

+34
-42
lines changed

1 file changed

+34
-42
lines changed

index.js

+34-42
Original file line numberDiff line numberDiff line change
@@ -48,51 +48,43 @@ module.exports = themeConfig => {
4848
},
4949
}
5050

51-
const { modifyBlogPluginOptions } = themeConfig
52-
53-
let blogPluginOptions
54-
55-
if (typeof modifyBlogPluginOptions === 'function') {
56-
blogPluginOptions = modifyBlogPluginOptions(defaultBlogPluginOptions)
57-
} else {
58-
let resolvedFeedOptions
59-
const isFeedEnabled = themeConfig.feed && themeConfig.feed.canonical_base
60-
if (isFeedEnabled) {
61-
const {
62-
rss = true,
63-
atom = false,
64-
json = false,
65-
...feedOptions
66-
} = themeConfig.feed
67-
resolvedFeedOptions = Object.assign({}, feedOptions, {
68-
feeds: {
69-
rss2: { enable: rss },
70-
atom1: { enable: atom },
71-
json1: { enable: json },
72-
},
73-
})
74-
}
75-
76-
const properties = [
77-
'directories',
78-
'frontmatters',
79-
'globalPagination',
80-
'sitemap',
81-
'comment',
82-
'newsletter',
83-
]
84-
const themeConfigPluginOptions = {
85-
...pick(themeConfig, properties),
86-
feed: resolvedFeedOptions,
87-
}
51+
let resolvedFeedOptions
52+
const isFeedEnabled = themeConfig.feed && themeConfig.feed.canonical_base
53+
if (isFeedEnabled) {
54+
const {
55+
rss = true,
56+
atom = false,
57+
json = false,
58+
...feedOptions
59+
} = themeConfig.feed
60+
resolvedFeedOptions = Object.assign({}, feedOptions, {
61+
feeds: {
62+
rss2: { enable: rss },
63+
atom1: { enable: atom },
64+
json1: { enable: json },
65+
},
66+
})
67+
}
8868

89-
blogPluginOptions = Object.assign(
90-
{},
91-
defaultBlogPluginOptions,
92-
themeConfigPluginOptions
93-
)
69+
const properties = [
70+
'directories',
71+
'frontmatters',
72+
'globalPagination',
73+
'sitemap',
74+
'comment',
75+
'newsletter',
76+
]
77+
const themeConfigPluginOptions = {
78+
...pick(themeConfig, properties),
79+
feed: resolvedFeedOptions,
9480
}
9581

82+
const blogPluginOptions = Object.assign(
83+
{},
84+
defaultBlogPluginOptions,
85+
themeConfigPluginOptions
86+
)
87+
9688
/**
9789
* Integrate plugins
9890
*/

0 commit comments

Comments
 (0)