Updated to grab the correct permalink for posts.