Skip to content

Commit

Permalink
docs: Add API document to menu (#845)
Browse files Browse the repository at this point in the history
Ref #581
  • Loading branch information
popomore authored and fengmk2 committed May 4, 2017
1 parent edfc07e commit af174ef
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "0.0.0",
"private": true,
"hexo": {
"version": "3.2.2"
"version": "3.3.5"
},
"dependencies": {
"hexo": "^3.2.0",
Expand All @@ -15,4 +15,4 @@
"markdown-it-replace-link": "^1.0.0",
"markdown-it-toc-and-anchor": "^4.1.1"
}
}
}
6 changes: 3 additions & 3 deletions docs/source/_data/menu.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
guide: /intro/
# api: /api
tutorials: /tutorials/index.html
guide: intro/
api: /api/
tutorials: tutorials/index.html
plugins: https://github.com/search?q=topic%3Aegg-plugin&type=Repositories
release: https://github.com/eggjs/egg/releases
3 changes: 0 additions & 3 deletions docs/source/api/index.md

This file was deleted.

7 changes: 5 additions & 2 deletions docs/themes/egg/scripts/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,11 @@ hexo.extend.helper.register('menu_link', function() {
let link = menus[menu];
const content = getI18nText(this.__, menu, 'menu.');

if (this.page.lang !== 'en' && !/^http/.test(link)) {
link = '/' + this.page.lang + link;
// http://example.com -> http://example.com
// /api -> /api
// intro/ -> /zh-cn/intro/
if (this.page.lang !== 'en' && !/^http/.test(link) && !/^\//.test(link)) {
link = '/' + this.page.lang + '/' + link;
}
links += `<li><a href="${link}" alt="${content}">${content}</a></li>`;
}
Expand Down
2 changes: 1 addition & 1 deletion scripts/doc.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ co(function* () {

switch (command) {
case 'server':
yield runscript('hexo --cwd docs server -l');
yield jsdoc('docs/public/api');
yield runscript('hexo --cwd docs server -l');
break;
case 'build':
yield runscript('hexo --cwd docs generate --force');
Expand Down

0 comments on commit af174ef

Please sign in to comment.