Skip to content

Commit

Permalink
Sort the TOC of the contribute section
Browse files Browse the repository at this point in the history
Made the Contribute page sidebar (table of content) sorted, closing #67.
  • Loading branch information
jgkim committed Aug 13, 2015
1 parent 7117644 commit 7672d69
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 5 deletions.
22 changes: 22 additions & 0 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,28 @@ meta:
slug: 'following-up'
- title: 'Appendices'
slug: 'appendices'
contribute:
label: contribute
output: true
title: Contribute
has_translation: false
toc:
chapters:
- title: 'Contributing To The Handbook'
- title: 'Adding A Page'
slug: 'adding'
- title: 'Editing A Page'
slug: 'editing'
- title: 'Adding A Term To The Glossary'
slug: 'add-term'
- title: 'Adding A Resource To The Library'
slug: 'add-resource'
- title: 'Translating The Guide'
slug: 'translate-guide'
- title: 'Translating The Glossary'
slug: 'translate-glossary'
- title: 'Markdown Examples'
slug: 'markdown-examples'

defaults:
-
Expand Down
13 changes: 8 additions & 5 deletions _includes/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
{% assign glossary = site.meta.glossary %}
{% assign value-stories = site.meta.value-stories %}
{% assign resources = site.meta.resources %}
{% assign contribute = site.meta.contribute %}
{% assign guide_entry_point = site.baseurl | append: '/' | append: guide.label | append: '/' | append: page.lang | append: '/' | append: guide.toc.entry_point | append: '/' %}
{% assign glossary_entry_point = site.baseurl | append: '/' | append: glossary.label | append: '/' | append: page.lang | append: '/' %}
{% assign value-stories_entry_point = site.baseurl | append: '/' | append: value-stories.label | append: '/' | append: page.lang | append: '/' %}
Expand Down Expand Up @@ -181,12 +182,14 @@
<li class="{% if page.url contains 'contribute' %}Selected{% endif %}">
<a href="{{ "/contribute/" | prepend: site.baseurl }}">Contribute</a>
<ul>
{% for contribute_page in site.pages %}
{% if contribute_page.section == 'contribute' %}
<li {% if contribute_page.url == page.url %} class="Selected"{% endif %}>
<a href="{{ contribute_page.url }}">{{ contribute_page.title }}</a>
</li>
{% for chapter in contribute.toc.chapters %}
{% assign chapter_url = site.baseurl | append: '/' | append: contribute.label | append: '/' %}
{% if chapter.slug %}
{% assign chapter_url = chapter_url | append: chapter.slug | append: '/' %}
{% endif %}
<li {% if chapter_url == page.url %} class="Selected"{% endif %}>
<a href="{{ chapter_url }}">{{ chapter.title }}</a>
</li>
{% endfor %}
</ul>
</li>
Expand Down

0 comments on commit 7672d69

Please sign in to comment.