pages_list 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. {% comment %}<!--
  2. The pages_list include is a listing helper.
  3. Usage:
  4. 1) assign the 'pages_list' variable to a valid array of pages or posts.
  5. 2) include JB/pages_list
  6. example:
  7. <ul>
  8. {% assign pages_list = site.pages %}
  9. {% include JB/pages_list %}
  10. </ul>
  11. Grouping: (optional):
  12. assign the 'group' variable to constrain the list to only pages/posts
  13. in the given group. Note you must define the group manually in the page/post
  14. meta-data to use this feature.
  15. Grouping is mainly helpful for non-post pages.
  16. If you want to group posts, it's easier/better to tag them, then pass the tagged posts array.
  17. i.e. site.tags.cool_tag (this returns an array of posts tagged: cool_tag)
  18. This helper can be seen in use at: ../_layouts/default.html
  19. -->{% endcomment %}
  20. {% if site.JB.pages_list.provider == "custom" %}
  21. {% include custom/pages_list %}
  22. {% else %}
  23. {% for node in pages_list %}
  24. {% if node.title != null %}
  25. {% if group == null or group == node.group %}
  26. {% if page.url == node.url %}
  27. <li class="active"><a href="{{ BASE_PATH }}{{node.url}}" class="active">{{node.title}}</a></li>
  28. {% else %}
  29. <li><a href="{{ BASE_PATH }}{{node.url}}">{{node.title}}</a></li>
  30. {% endif %}
  31. {% endif %}
  32. {% endif %}
  33. {% endfor %}
  34. {% endif %}
  35. {% assign pages_list = nil %}
  36. {% assign group = nil %}