Skip to content

Commit

Permalink
Merge pull request #212 from Qard/knowledge-base-index
Browse files Browse the repository at this point in the history
Add auto-generated index to knowledge base
  • Loading branch information
fhemberger committed Oct 20, 2015
2 parents 317bc49 + 9729af8 commit b415dee
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 16 deletions.
4 changes: 4 additions & 0 deletions build.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,10 @@ function buildlocale (source, locale) {
sortBy: 'date',
reverse: true,
refer: false
},
knowledgeBase: {
pattern: 'knowledge/**/*.md',
refer: false
}
}))
.use(markdown(markedOptions))
Expand Down
17 changes: 1 addition & 16 deletions layouts/docs.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,7 @@
<div id="main">
<div class="container has-side-nav">

<aside>
<ul>
<li{{#equals path site.docs.link}} class="active"{{/equals}}>
<a href="/{{site.locale}}/{{site.docs.link}}/">{{site.docs.text}}</a>
</li>
<li{{#equals path site.docs.es6.link}} class="active"{{/equals}}>
<a href="/{{site.locale}}/{{site.docs.es6.link}}/">{{site.docs.es6.text}}</a>
</li>
<li{{#equals path site.docs.faq.link}} class="active"{{/equals}}>
<a href="/{{site.locale}}/{{site.docs.faq.link}}/">{{site.docs.faq.text}}</a>
</li>
<li{{#equals path site.docs.api.link}} class="active"{{/equals}}>
<a href="{{site.docs.api.link}}">{{site.docs.api.text}}</a>
</li>
</ul>
</aside>
{{> docs-menu }}

<article>
{{{ contents }}}
Expand Down
26 changes: 26 additions & 0 deletions layouts/knowledge-base-index.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<!DOCTYPE html>
<html lang="{{site.locale}}">
{{> html-head }}

<body>
{{> header }}

<div id="main">
<div class="container has-side-nav">

{{> docs-menu }}

<article>
{{{ contents }}}

{{#each collections.knowledgeBase}}
<li><a href="/{{../site.locale}}/{{ path }}/">{{ title }}</a></li>
{{/each}}
</article>

</div>
</div>

{{> footer }}
</body>
</html>
6 changes: 6 additions & 0 deletions locale/en/knowledge/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
title: Knowledge Base
layout: knowledge-base-index.hbs
---

# Knowledge Base
4 changes: 4 additions & 0 deletions locale/en/site.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@
"api": {
"link": "/api/",
"text": "API"
},
"knowledge": {
"link": "knowledge",
"text": "Knowledge Base"
}
},
"foundation": {
Expand Down

0 comments on commit b415dee

Please sign in to comment.