1. A method for presenting content items comprising: receiving a plurality of content items; determining size constraints of each of the plurality of content items; selecting a plurality of candidate templates each having a number of slots, each slot defining a portion of a page within which a content item is displayed; for each candidate template of the plurality of candidate templates, determining a score for the candidate template by: determining a score for each slot of the candidate template based on a difference between a size of the slot of the candidate template and the size constraints of one or more of the plurality of content items, where a minimum score is assigned to the slot if the size difference between the size of the slot and size constraints of the content item exceeds a threshold difference, and determining the score for the candidate template based on aggregating the scores of the slots of the candidate template; selecting a template from the plurality of candidate templates based on the determined scores; and generating the page for presentation to a user, the page including one or more of the plurality of content items positioned based on slots in the selected template.
1. A method for presenting content items comprising: receiving a plurality of content items; determining size constraints of each of the plurality of content items; selecting a plurality of candidate templates each having a number of slots, each slot defining a portion of a page within which a content item is displayed; for each candidate template of the plurality of candidate templates, determining a score for the candidate template by: determining a score for each slot of the candidate template based on a difference between a size of the slot of the candidate template and the size constraints of one or more of the plurality of content items, where a minimum score is assigned to the slot if the size difference between the size of the slot and size constraints of the content item exceeds a threshold difference, and determining the score for the candidate template based on aggregating the scores of the slots of the candidate template; selecting a template from the plurality of candidate templates based on the determined scores; and generating the page for presentation to a user, the page including one or more of the plurality of content items positioned based on slots in the selected template. 2. The method of claim 1 , wherein one or more of the plurality of content items comprise user-generated posts on social networks.