permalinks converted to those domain based !

Inactive
  • 28 points
    Starting to get into this DEV thing
    I'm helpful
    boowp

    Member  —  27th March 2011 (1 year ago)         

    Hello,

    pls note below improvement of sitemap generarion.
    Because of domains mapped on main main blog where a blog have HIS own domain mapped the sitemap should be generated with a permalink refer to that domain and not a subdirectory.
    here is an excample
    suppose domain.com is main domain host the wp mu
    and http://domain.com/blog1 without a mapped domain the permalinks will be http://domain.com/blog1/xxxxx and so on. thats is ok
    BUT if a domain is mapped on that blog1, suppose blog1.com so the permalinks should be
    http://blog1.com/xxxxx

    unable to find a wp get_permalink function domain mapped 'aware', the simple-sitemaps.php has been changed in this way (feel free to update your code without quote the author)

    under the var totalposts note added code:

    class Incsub_SimpleSitemaps {

    var $totalposts = 50; // Number of posts to display

    private $map_domain_blog_url, $blog_url;

    function __construct() {
    global $wpdb;

    $this->map_domain_blog_url = "http://" . $wpdb->get_var( "SELECT domain FROM {$wpdb->dmtable} WHERE blog_id = '{$wpdb->blogid}'" ) . "/";
    $this->blog_url = get_blogaddress_by_id($wpdb->blogid);
    }

    then added code before writefile function:

    // Convert main blog based permalink to domain mapped permalink
    function get_permalink_dom( $id ){
    global $wpdb;

    $plink = get_permalink( $id );
    $plink = $this->map_domain_blog_url . substr($plink, $this->strlen(blog_url));

    return $plink;
    }

    then simply replace get_permalink calls in your code with $this->get_permalink_dom( $post->ID )

    And now, each domain blog based sitemap, have inside links based on that domain !!!

    many thanks!
    any subscription extension if granted, will be appreciated. or use the code updateding your plugin and reflect on each other use non domain based links. where personally hided to search engines. because any blogs should expose only its own domain based links...