/hyde/layouts/starter/content/advanced/grouper.html

http://github.com/hyde/hyde · HTML · 49 lines · 37 code · 12 blank · 0 comment · 0 complexity · 25d4eec75354fa45741108d0ea7c4b4c MD5 · raw file

  1. ---
  2. index: 3
  3. title: Grouping
  4. tags:
  5. - sort
  6. - group
  7. learning_order: 2
  8. ---
  9. Grouping
  10. ========
  11. Content is very often grouped by theme, size, location or any other
  12. conceivable measure. Groups can be traversed in a few ways in Hyde, and
  13. [sorted](sorter.html) at the same time. Here are two common ways:
  14. Walking all groups and subgroups
  15. --------------------------------
  16. {# Resources are sorted by defining a sorter in the configuration file. #}
  17. {% for grp, res_walker in site.content.walk_level_groups() %}
  18. *{{ grp.description }}*
  19. {% for res in res_walker %}
  20. * [{{ res.slug|capitalize|replace("-"," ") }}]({{ res.full_url }})
  21. ({{ res.name }})
  22. {% endfor %}
  23. {% endfor %}
  24. {# The above code layout is not arbitrary. Remember that we're building
  25. a Markdown page so every space or line ending has a purpose.
  26. #}
  27. Listing only the specific (sub)group
  28. ------------------------------------
  29. {% for res in site.content.walk_resources_grouped_by_advanced() %}
  30. * [{{ res.slug|capitalize|replace("-"," ") }}]({{ res.full_url }})
  31. ({{ res.name }})
  32. {% endfor %}
  33. {# You can also call the top level group "level" to get all resources that
  34. are in the group. Or you can list all resources of the same group in the
  35. current node with "resource.node.walk_resource_grouped_by_advanced()".
  36. #}
  37. {{ macros.render_bottom_article_nav() }}