2019-04-15 10:35:40 +08:00
|
|
|
const path = require('path')
|
|
|
|
|
|
|
|
// Theme API.
|
|
|
|
module.exports = (options, ctx) => ({
|
|
|
|
alias () {
|
|
|
|
const { themeConfig, siteConfig } = ctx
|
|
|
|
// resolve algolia
|
|
|
|
const isAlgoliaSearch = (
|
2019-09-20 13:54:13 +08:00
|
|
|
themeConfig.algolia ||
|
|
|
|
Object.keys(siteConfig.locales && themeConfig.locales || {})
|
2019-04-15 10:35:40 +08:00
|
|
|
.some(base => themeConfig.locales[base].algolia)
|
|
|
|
)
|
|
|
|
return {
|
|
|
|
'@AlgoliaSearchBox': isAlgoliaSearch
|
|
|
|
? path.resolve(__dirname, 'components/AlgoliaSearchBox.vue')
|
2019-11-28 11:49:03 +08:00
|
|
|
: path.resolve(__dirname, 'noopModule.js'),
|
|
|
|
'@SearchBox': path.resolve(__dirname, 'components/SearchBox.vue')
|
2019-04-15 10:35:40 +08:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
plugins: [
|
2019-10-07 22:32:02 +08:00
|
|
|
'@vuepress-reco/back-to-top',
|
2019-11-01 19:32:52 +08:00
|
|
|
'@vuepress-reco/extract-code',
|
2019-10-07 22:32:02 +08:00
|
|
|
'@vuepress-reco/loading-page',
|
|
|
|
'@vuepress-reco/pagation',
|
2019-10-16 15:06:20 +08:00
|
|
|
'@vuepress-reco/comments',
|
2019-04-15 10:35:40 +08:00
|
|
|
'@vuepress/active-header-links',
|
2019-10-23 23:17:42 +08:00
|
|
|
['@vuepress/medium-zoom', {
|
|
|
|
selector: '.theme-reco-content :not(a) > img'
|
|
|
|
}],
|
2019-10-17 19:33:21 +08:00
|
|
|
'@vuepress/plugin-nprogress',
|
2019-06-25 11:31:44 +08:00
|
|
|
['@vuepress/plugin-blog', {
|
2019-10-04 20:35:28 +08:00
|
|
|
permalink: '/:regular',
|
|
|
|
frontmatters: [
|
|
|
|
{
|
|
|
|
id: 'tags',
|
|
|
|
keys: ['tags'],
|
|
|
|
path: '/tag/',
|
|
|
|
layout: 'Tags',
|
|
|
|
scopeLayout: 'Tag'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
id: 'categories',
|
|
|
|
keys: ['categories'],
|
|
|
|
path: '/categories/',
|
|
|
|
layout: 'Categories',
|
|
|
|
scopeLayout: 'Category'
|
2019-10-17 19:33:21 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
id: 'timeline',
|
|
|
|
keys: ['timeline'],
|
|
|
|
path: '/timeline/',
|
|
|
|
layout: 'TimeLines',
|
|
|
|
scopeLayout: 'TimeLine'
|
2019-10-09 19:14:28 +08:00
|
|
|
}
|
|
|
|
]
|
2019-06-25 11:31:44 +08:00
|
|
|
}],
|
2019-04-15 10:35:40 +08:00
|
|
|
['container', {
|
|
|
|
type: 'tip',
|
|
|
|
defaultTitle: {
|
|
|
|
'/zh/': '提示'
|
|
|
|
}
|
|
|
|
}],
|
|
|
|
['container', {
|
|
|
|
type: 'warning',
|
|
|
|
defaultTitle: {
|
|
|
|
'/zh/': '注意'
|
|
|
|
}
|
|
|
|
}],
|
|
|
|
['container', {
|
|
|
|
type: 'danger',
|
|
|
|
defaultTitle: {
|
|
|
|
'/zh/': '警告'
|
|
|
|
}
|
|
|
|
}]
|
|
|
|
]
|
|
|
|
})
|