In the Aggregator module, limit number of items per feed I am using the Aggregator module in Drupal 8 to combine several RSS feeds, but I would like to set a limit on the number of items that are shown from any one feed. How can I accomplish this?
This might not be the right way to do it but I solved this by using template_preprocess_aggregator_feed(&amp;$variables) and then slice the items using array_slice(). 

My items were stored at $variables['content']['items'] but there were two other hashtag variables stored in the beginning of the array so I had to add that to the total count.

function template_preprocess_aggregator_feed(&amp;$variables) {
  $number_of_items = 5;
  $variables['content']['items'] = array_slice($variables['content']['items'],0,2 + $number_of_items);
}