Skip to content

Instantly share code, notes, and snippets.

@phirefly
Created July 14, 2013 20:21
Show Gist options
  • Save phirefly/5995809 to your computer and use it in GitHub Desktop.
Save phirefly/5995809 to your computer and use it in GitHub Desktop.
Jekyll: generate pages by weight (1..10) and group 'topnavigation'
<ul id="top-nav">
{% for weight in (1..10) %}
{% for node in site.pages %}
{% if node.group == 'topnavigation' %}
{% if node.weight == weight %}
{% if page.url == node.url %}
<li class="active"><a href="{{site.baseurl}}{{node.url}}" class="active">{{node.title}}</a></li>
{% else %}
<li><a href="{{site.baseurl}}{{node.url}}" class="active">{{node.title}}</a></li>
{% endif %}
{% endif %}
{% endif %}
{% endfor %}
{% endfor %}
</ul>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment