diff --git a/docs/.vuepress/config.js b/docs/.vuepress/config.js index 19ac2078..c6ad92cc 100644 --- a/docs/.vuepress/config.js +++ b/docs/.vuepress/config.js @@ -1,7 +1,26 @@ module.exports = { title: 'ZiuChen', description: 'Unlimited Progress.', - head: [['link', { rel: 'icon', href: '/logo.png' }]], + head: [ + ['link', { rel: 'icon', href: '/logo.png' }], + [ + 'script', + {}, + /* js */ ` + var _hmt = _hmt || []; + (function() { + var hm1 = document.createElement("script"); + hm1.src = "https://hm.baidu.com/hm.js?08b4ef50a9244e83e5a1bd5822442829"; // gitee + var hm2 = document.createElement("script"); + hm2.src = "https://hm.baidu.com/hm.js?50bac15a1f238d1aa61f104a5fb6f5e0"; // github + var s = document.getElementsByTagName("script")[0]; + s.parentNode.insertBefore(hm1, s); + s.parentNode.insertBefore(hm2, s); + })(); + + ` + ] + ], plugins: [ '@vuepress/medium-zoom', '@vuepress/active-header-links', diff --git a/docs/.vuepress/enhanceApp.js b/docs/.vuepress/enhanceApp.js new file mode 100644 index 00000000..083b9e88 --- /dev/null +++ b/docs/.vuepress/enhanceApp.js @@ -0,0 +1,10 @@ +export default ({ router }) => { + router.beforeEach((to, from, next) => { + if (typeof _hmt !== 'undefined') { + if (to.path) { + _hmt.push(['_trackPageview', to.fullPath]) // 添加埋点上报 + } + } + next() // 执行路由跳转 + }) +}