PageRenderTime 8ms CodeModel.GetById 4ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

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