Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds a Github link on the API page's sidebar #148

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions src/tmpl/docs.jade
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,18 @@ block content
ul.nav.nav-list
each link in sidebar
if link.url
if locals.rootSidebar
li
a(href='/' + link.url, class=locals.pageSegment == link.url && 'active')= link.name
- var linkHref
if link.external
- linkHref = link.url
else if locals.rootSidebar
- linkHref = '/' + link.url
else
li
a(href='/' + page + '/' + link.url, class=locals.pageSegment == link.url && 'active')= link.name
- linkHref = '/' + page + '/' + link.url
li
a(href=linkHref, class=locals.pageSegment == link.url && 'active')= link.name
else
li.nav-header
if link.icon
i(class=link.icon)
span= link.name
include blocks/advertisements
include blocks/advertisements
6 changes: 6 additions & 0 deletions tasks/docs.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,12 @@ module.exports = function (grunt) {
sidebars[0] = getSidebarSection('## API', 'icon-cog');
sidebars[1] = getSidebarSection('### Other');

sidebars[1].push({
name: 'GitHub',
url: 'https://github.com/gruntjs/',
external: true
});
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's not the better implementation, but inserting entries on the docs with external urls would require some over optimization. I can try to do that too, it would just require more time.


names.forEach(function (name) {
var src = base + name + '.md',
dest = 'build/api/' + name.toLowerCase() + '.html';
Expand Down