Sort permalinks by mimetype and return the first permalink #34