I'm grouping search results by section, based on Aaron Berkowitz's answer to this question. My code looks like this:
{% set entries = craft.entries({search: {query: keywords} }) %}
{% set entriesBySection = entries | group('section') %}
{% for section, entries in entriesBySection %}
<h2>{{ section }}</h2>
<ul>
{% for entry in entries %}
<li>{{ entry.title }}</li>
{% endfor %}
</ul>
{% endfor %}
That works great but I need to show the sections in a specific order, and merge some sections into one. So I'd end up with, for example:
- News
- Products
- Reports
- Other (everything else combined)
Any idea how to do this?
Thanks loads for any help!