Change online route to post index and make iteration more defensive