提交 eec3048c 编写于 作者: U ULIVZ

fix: make 'lastUpdated' backward compatible

上级 3ba2254f
......@@ -14,7 +14,9 @@ module.exports = function (options) {
const plugin = new Plugin(pluginContext)
plugin
.use(lastUpdatedPlugin)
// 1. user plugin
.useByConfigs(siteConfig.plugins)
// 2. built-in plugins
.use(enhanceAppPlugin)
.use(registerGlobalComponentsPlugin, {
baseDirs: [
......@@ -22,12 +24,22 @@ module.exports = function (options) {
path.resolve(themePath, 'components')
]
})
.useByConfigs(siteConfig.plugins)
// 1. whether to use active header links
const { activeHeaderLinks = true } = themeConfig
if (activeHeaderLinks) {
plugin.use(activeHeaderLinksPlugin)
}
// 2. whether to use last updated
const shouldUseLastUpdated = (
themeConfig.lastUpdated ||
Object.keys(siteConfig.locales && themeConfig.locales || {})
.some(base => themeConfig.locales[base].lastUpdated)
)
if (shouldUseLastUpdated) {
plugin.use(lastUpdatedPlugin)
}
return plugin
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册