Make navigation menus reusable

This commit is contained in:
Anatol Broder 2013-09-06 02:00:23 +02:00
parent 3f7dcaa2ec
commit 102d83f78d
2 changed files with 31 additions and 0 deletions

View File

@ -0,0 +1,11 @@
{% assign items = include.items | split: ' ' %}
{% for item in items %}
{% assign item_url = item | prepend:'/docs/' | append:'/' %}
{% for p in site.pages %}
{% if p.url == item_url %}
<option value="{{ site.url }}{{ p.url }}">{{ p.title }}</option>
{% endif %}
{% endfor %}
{% endfor %}

View File

@ -0,0 +1,20 @@
{% assign items = include.items | split: ' ' %}
<ul>
{% for item in items %}
{% assign item_url = item | prepend:'/docs/' | append:'/' %}
{% if item_url == page.url %}
{% assign c = 'current' %}
{% else %}
{% assign c = '' %}
{% endif %}
{% for p in site.pages %}
{% if p.url == item_url %}
<li class="{{ c }}"><a href="{{ p.url }}">{{ p.title }}</a></li>
{% endif %}
{% endfor %}
{% endfor %}
</ul>