Skip to content

Commit 6fa02ff

Browse files
committed
Adds a Github link on the API page's sidebar
Fixes gruntjs#137
1 parent 7de2732 commit 6fa02ff

File tree

2 files changed

+15
-6
lines changed

2 files changed

+15
-6
lines changed

src/tmpl/docs.jade

+9-6
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,18 @@ block content
1717
ul.nav.nav-list
1818
each link in sidebar
1919
if link.url
20-
if locals.rootSidebar
21-
li
22-
a(href='/' + link.url, class=locals.pageSegment == link.url && 'active')= link.name
20+
- var linkHref
21+
if link.external
22+
- linkHref = link.url
23+
else if locals.rootSidebar
24+
- linkHref = '/' + link.url
2325
else
24-
li
25-
a(href='/' + page + '/' + link.url, class=locals.pageSegment == link.url && 'active')= link.name
26+
- linkHref = '/' + page + '/' + link.url
27+
li
28+
a(href=linkHref, class=locals.pageSegment == link.url && 'active')= link.name
2629
else
2730
li.nav-header
2831
if link.icon
2932
i(class=link.icon)
3033
span= link.name
31-
include blocks/advertisements
34+
include blocks/advertisements

tasks/docs.js

+6
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,12 @@ module.exports = function (grunt) {
9999
sidebars[0] = getSidebarSection('## API', 'icon-cog');
100100
sidebars[1] = getSidebarSection('### Other');
101101

102+
sidebars[1].push({
103+
name: 'Github',
104+
url: 'https://github.com/gruntjs/',
105+
external: true
106+
});
107+
102108
names.forEach(function (name) {
103109
var src = base + name + '.md',
104110
dest = 'build/api/' + name.toLowerCase() + '.html';

0 commit comments

Comments
 (0)