Group news records

The following example will group all given news records by the property "firstCategory".

<f:if condition="{news}">
      <div style="border:1px solid red">
         <f:groupedFor each="{news}" as="groupedNews" groupBy="firstCategory" groupKey="cat">
            <div style="border:1px solid blue;padding:10px;margin:10px;">
               <f:for each="{groupedNews}" as="newsItem">
                  <div style="border:1px solid pink;padding:5px;margin:5px;">
      <div class="no-news-found">
         <f:translate key="list_nonewsfound"/>

Keep an eye on performance!

To be able to group the records, Fluid will load every record itself and groups those afterwards.

If you plan to group many records just for getting something like a count, maybe it is better to fire the query directly and don't use Fluid for that.

However if the result is on a cacheable page, the issue is only relevant on the first hit.