-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
42 lines (35 loc) · 957 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
const reverse = require('lodash.reverse')
const sortBy = require('lodash.sortby')
module.exports = (options, ctx) => {
const plugins = {
['named-chunks']: {
pageChunkName: (page) => 'page' + page.key.slice(1),
layoutChunkName: (layout) => 'layout-' + layout.componentName,
},
}
if (options.hostname) {
plugins.sitemap = {
hostname: options.hostname,
}
plugins.feed = {
canonical_base: options.hostname,
posts_directories: options.posts_directories || ['/posts'],
sort: (entries) => reverse(sortBy(entries, 'date')),
}
}
if (options.ga) {
plugins['@vuepress/google-analytics'] = {
ga: options.ga,
}
}
if (!options.disableBackToTop) {
plugins['@vuepress/back-to-top'] = options.backToTop || {}
}
if (!options.disableFlowChart) {
plugins['flowchart-js'] = options.flowchart || {}
}
return {
extend: '@vuepress/theme-default',
plugins,
}
}