function pugpig_permalink($permalink, $endpoint = null)
{
    // Ignore this if we are outputting a feed
    if (pugpig_is_pugpig_url()) {
        $permalink = pugpig_rewrite_html_url($permalink);
    }
    return $permalink;
}
function pugpig_get_html_url($post, $edition_id = "")
{
    // Ad bundles should return the path to the actual bundle HTML file - not the slug URL which then results in a redirect
    // (and a different relative URL to the ad bundle contents)
    $atom_url = pugpig_permalink(pugpig_get_permalink($post));
    $return_url = pugpig_rewrite_html_url($atom_url);
    $return_url = apply_filters('pugpig_get_content_html_url', $return_url, $post, $edition_id);
    return $return_url;
    /*
      // TODO: MOVE THESE INTO A HOOK TO BE IMPLEMENTED BY AD BUNDLE AND CUSTOM
      if (isset($post) && $post->post_type == PUGPIG_AD_BUNDLE_POST_TYPE) {
        return pugpig_ad_bundle_url($post);
      } elseif (isset($post) && $post->post_type == 'section_index') {
          $atom_url = pugpig_permalink(get_permalink($post));
    
        return pugpig_rewrite_html_url($atom_url) . "/" . $edition_id;
      } else {
        $atom_url = pugpig_permalink(get_permalink($post));
    
        return pugpig_rewrite_html_url($atom_url);
      }
    */
}