config.js 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. const langs = [
  2. {title: 'English', path: '/home'},
  3. {title: '中文', path: '/zh/'},
  4. ]
  5. docute.init({
  6. landing: true,
  7. repo: 'tboox/xmake',
  8. twitter: 'waruqi',
  9. 'edit-link': 'https://github.com/xmake-io/xmake-docs/blob/master/',
  10. announcement(route) {
  11. const info = { type: 'success' }
  12. if (/\/zh/.test(route.path)) {
  13. info.html = '<a style="margin-right:10px;" class="docute-button docute-button-mini docute-button-success" href="/cn/pages/donation.html#donate" target="_blank">捐赠!</a> 通过成为赞助商或者一次性捐赠支持xmake的开发和文档更新。'
  14. } else {
  15. info.html = '<a style="margin-right:10px;" class="docute-button docute-button-mini docute-button-success" href="/pages/donation.html#donate" target="_blank">Donate!</a> Support xmake development and documentation updates by becoming a sponsor or one-time donation.'
  16. }
  17. return info
  18. },
  19. nav: {
  20. default: [
  21. {
  22. title: 'Home', path: '/home'
  23. },
  24. {
  25. title: 'Plugins', path: '/plugins'
  26. },
  27. {
  28. title: 'Manual', path: '/manual'
  29. },
  30. {
  31. title: 'Articles', path: 'https://tboox.org/category/#xmake'
  32. },
  33. {
  34. title: 'Feedback', path: 'https://github.com/xmake-io/xmake/issues'
  35. },
  36. {
  37. title: 'Community', path: 'https://www.reddit.com/r/tboox/'
  38. },
  39. {
  40. title: 'English', type: 'dropdown', items: langs, exact: true
  41. }
  42. ],
  43. 'zh': [
  44. {
  45. title: '首页', path: '/zh/'
  46. },
  47. {
  48. title: '插件', path: '/zh/plugins'
  49. },
  50. {
  51. title: '手册', path: '/zh/manual'
  52. },
  53. {
  54. title: '文章', path: 'https://tboox.org/cn/category/#xmake'
  55. },
  56. {
  57. title: '反馈', path: 'https://github.com/xmake-io/xmake/issues'
  58. },
  59. {
  60. title: '社区', path: 'https://www.reddit.com/r/tboox/'
  61. },
  62. {
  63. title: '中文', type: 'dropdown', items: langs, exact: true
  64. }
  65. ]
  66. },
  67. plugins: [
  68. docsearch({
  69. apiKey: 'fbba61eefc60a833d8caf1fa72bd8ef8',
  70. indexName: 'xmake',
  71. tags: ['en', 'zh'],
  72. url: 'https://xmake.io'
  73. }),
  74. function valine(context) {
  75. context.registerComponent('content:end', {
  76. template: '<div class="markdown-body content"><h2 id="comments">Comments</h2><div id="gitalk_thread"></div></div>',
  77. mounted() {
  78. this.init()
  79. },
  80. methods: {
  81. init() {
  82. const gitalk = new Gitalk({
  83. clientID: 'cb53dd42b1b654202a55',
  84. clientSecret: '8a9a0e7feadc575b8bba9770cd9454d7423028ac',
  85. repo: 'xmake-docs',
  86. owner: 'waruqi',
  87. admin: ['waruqi'],
  88. id: location.pathname,
  89. distractionFreeMode: false
  90. })
  91. gitalk.render('gitalk_thread')
  92. }
  93. }
  94. })
  95. }
  96. ]
  97. })