private function buildCollectionsWithType($documents)
{
$collections = array();
foreach ($documents as $document) {
$type = $document->getType() . 's';
if (!array_key_exists($type, $collections)) {
$collections[$type] = array();
}
$collections[$type][$document->getFilePath()] = $document;
}
if (isset($collections['posts'])) {
$collections['posts'] = $this->sortByDate($collections['posts']);
}
return $collections;
}