Skip to content

Commit

Permalink
Extract sidebar and uses collections
Browse files Browse the repository at this point in the history
  • Loading branch information
noirbizarre committed Nov 28, 2017
1 parent 01d296b commit b1ff62b
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 21 deletions.
1 change: 1 addition & 0 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ collections:
faq:
title: Découvrir l'OpenData
output: true
order: 1


defaults:
Expand Down
15 changes: 15 additions & 0 deletions _includes/sidebar.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<nav class="side-pane">
<ul>
{% assign collections = site.collections | sort: 'order' %}
{% for collection in collections %}
{% if collection.docs %}
<li class="side-pane__title"><h3>{{ collection.title }}</h3></li>
{% for col_page in collection.docs %}
<li class="side-pane__link {% if page.id == col_page.id %}active{% endif %}">
<a href="{{ col_page.url | relative_url }}">{{ col_page.label| default: col_page.title | escape }}</a>
</li>
{% endfor %}
{% endif %}
{% endfor %}
</ul>
</nav>
22 changes: 1 addition & 21 deletions _layouts/page.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,7 @@

{% include hero.html %}
<div class="documentation">
<nav class="side-pane">
<ul>
<li class="side-pane__title"><h3>Découvrir l'OpenData en tant que</h3></li>
{% assign default_paths = site.pages | map: "path" %}
{% assign page_paths = site.header_pages | default: default_paths %}
{% if page_paths %}
{% for path in page_paths %}
{% assign my_page = site.pages | where: "path", path | first %}
{% if my_page.title %}
{% if my_page.title != page.title %}
<li class="side-pane__link">
{% else %}
<li class="side-pane__link active">
{% endif %}
<a href="{{ my_page.url | relative_url }}">{{ my_page.title | escape }}</a>
</li>
{% endif %}
{% endfor %}
{% endif %}
</ul>
</nav>
{% include sidebar.html %}
<div class="main-pane">
{{ content }}
</div>
Expand Down

0 comments on commit b1ff62b

Please sign in to comment.