-
Notifications
You must be signed in to change notification settings - Fork 6
/
config.js
117 lines (115 loc) · 4.09 KB
/
config.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
require('dotenv-safe').config()
const safeExternalLinkGen = require('./_utils/safeExternalLinkGen')
const extractPermalinkFromPost = require('./_utils/extractPermalinkFromPost')
const TITLE = 'Aussie Coder 土澳码农'
const HOSTNAME = 'https://kenberkeley.github.io'
const ISSUES = { text: 'Issues', link: 'https://github.com/kenberkeley/blog/issues' }
const SUBSCRIBE_CN = { text: '邮件订阅', link: 'https://mailchi.mp/a019f810e55d/aussiecoder' }
const SUBSCRIBE_EN = { text: 'Email Subscribe', link: 'https://mailchi.mp/cb2708d60b30/aussiecoderken' }
const YOUTUBE = { text: TITLE, link: 'https://www.youtube.com/channel/UCFdirk72XzSXmJ0qTgoTHFQ' }
// References:
// https://github.com/vuejs/vuepress/blob/master/packages/docs/docs/.vuepress/config.js
// https://github.com/meteorlxy/vuepress-theme-meteorlxy/blob/master/docs/.vuepress/config.js
module.exports = ctx => ({
title: TITLE,
locales: {
'/': { lang: 'en' }
},
evergreen: true,
plugins: [
'vuepress-plugin-check-md',
['@vuepress/google-analytics', {
ga: process.env.GOOGLE_ANALYTICS_ID
}],
['vuepress-plugin-clean-urls', {
normalSuffix: '/',
indexSuffix: '/'
}],
['vuepress-plugin-sitemap', {
hostname: HOSTNAME
}],
['vuepress-plugin-canonical', {
baseURL: HOSTNAME,
stripExtension: true
}]
],
markdown: {
extendMarkdown: md => {
md.use(require('markdown-it-replace-link'))
},
// TODO:https://github.com/meteorlxy/vuepress-theme-meteorlxy/issues/62
replaceLink (link, env) {
// env could be {} or { loader: {}, frontmatter: {...}, relativePath: '...' }
const curFilePath = env.relativePath
if (
curFilePath && curFilePath.startsWith('_posts/') && // in _posts/
link.startsWith('.') && link.endsWith('.md') // relative path
) {
return extractPermalinkFromPost(curFilePath, link)
}
return link
}
},
theme: 'meteorlxy',
themeConfig: {
lang: Object.assign(
require('vuepress-theme-meteorlxy/lib/langs/en-US'),
// https://github.com/meteorlxy/vuepress-theme-meteorlxy/blob/master/lib/langs/en-US.js#L4
{ posts: 'Articles' }
),
personalInfo: {
nickname: 'Ken',
description: `YouTube:<br>${safeExternalLinkGen(YOUTUBE)}`,
email: '[email protected]',
location: 'Melbourne, VIC',
organization: 'Sportsbet',
avatar: '/avatar.jpg',
sns: {
github: {
account: 'kenberkeley',
link: 'https://github.com/kenberkeley/blog'
},
linkedin: {
account: 'ken--huang',
link: 'https://linkedin.com/in/ken--huang'
}
}
},
nav: [
{ text: 'Home 首页', link: '/', exact: true },
{ text: 'Articles 文章', link: '/posts/' },
{ text: 'Resources 资源', link: '/resources/' },
{ text: 'BuyMeACoffee 打赏', link: '/tip/' },
{ text: 'YouTube', link: YOUTUBE.link },
ISSUES
],
header: {
showTitle: true,
},
footer: {
poweredBy: false,
poweredByTheme: false,
custom: '欢迎<a href="/tip/">打赏</a>鼓励我继续产出,如果文章对你有帮助的话<br>' +
`欢迎订阅我的 YouTube 频道 ${safeExternalLinkGen(YOUTUBE)}<br>` +
`欢迎${safeExternalLinkGen(SUBSCRIBE_CN)},所有文章均为原创,转载请注明出处<br>` +
`若有建议、意见或者其他疑问等,欢迎到 ${safeExternalLinkGen(ISSUES)} 交流<br>` +
'<br>' +
'You can <a href="/tip/">BuyMeACoffee</a> to encourage me if it helps<br>' +
`This is my YouTube channel ${safeExternalLinkGen(YOUTUBE)}<br>` +
`Welcome ${safeExternalLinkGen(SUBSCRIBE_EN)} / Repost with original links<br>` +
`If any suggestions or questions, please raise in ${safeExternalLinkGen(ISSUES)}`
},
lastUpdated: true,
comments: {
platform: 'github',
owner: 'kenberkeley',
repo: 'blog',
clientId: process.env.VSSUE_CLIENT_ID,
clientSecret: process.env.VSSUE_CLIENT_SECRET,
autoCreateIssue: true
},
pagination: {
perPage: 10
}
}
})