-
-
Save jamiepittock/2635516e95317e5c6ed6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% set topicsGrouped = craft.entries.section(portal.topicsHandle).limit(null).order('slug') | group('slug | first') %} | |
<div class="index"> | |
{% for letter, topics in topicsGrouped %} | |
<div class="index__item"> | |
<div class="index__letter">{{ letter | upper }}</div> | |
<div class="index__list"> | |
<ul> | |
{% for topic in topics %} | |
{# | |
{% set group = craft.categories.group(portal.topicsHandle).relatedTo(topic).first() %} | |
#} | |
{% set group = topic.businessTopicGroup.first() %} | |
<li> | |
<a href="/{{ topic.uri }}">{{ topic.title }}</a> | |
{% if group is not empty %}<span>{{ group }}</span>{% endif %} | |
</li> | |
{% endfor %} | |
</ul> | |
</div> | |
</div> | |
{% endfor %} | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I would need more information about the entries but my first idea would be -> get one big query outside the for-loop and then only loop throug the results