RaythaHQ / raytha

Raytha is a powerful CMS with an easy-to-use interface and fast performance. It offers custom content types, a template engine, and various access controls. It supports multiple storage providers and an automatically generated REST API. Upgrade your development workflow with Raytha.
MIT License
144 stars 30 forks source link

Liquid filter for groupby #92

Closed apexdodge closed 1 year ago

apexdodge commented 1 year ago

Ideally we have a custom filter that supports groupby in liquid.

Usage would be:

{% assign grouped_items = Target.Items | groupby: "PublishedContent.developer_name" %}
{% for grouped_item in grouped_items %}
    {{ grouped_item.key }}
    {% for item in grouped_item.items %}
        {{ item.PublishedContent.developer_name.Value }}
    {% endfor %}
{% endfor %}

developer_name would be the developer name specified in the config of the field.

apexdodge commented 1 year ago

Released with v1.0.3