WordPress.org

Support

Support » Plugins and Hacks » All in One SEO Pack » AIOSP – Add urls to the sitemap by plugin.

AIOSP – Add urls to the sitemap by plugin.

  • Hi, i’m developing an auto translating plugin and i’m using AIOSP for the SEO and Sitemap.
    Although i’ve seen the plugin author giving a couple of hooks to add custom urls to the sitemap, the ones there are not good enough.
    The post_filter and Query_filter gives back all the content from the post/page but the urls are the internal ones (yordomain.com/?p=333) not good if you are using pretty links.
    So i came with a solution for this, could the developer be kind enough to include this code in the next update, so we may use the new filter for include new urls?

    /** Return an XML sitemap index as a string. **/
    		function build_sitemap_index( $urls, $comment = '' ) {
    //This is the new filter: aiosp_sitemap_urls_filter gives an array with the urls.
    $urls = apply_filters( $this->prefix . 'urls_filter', $urls,$args);
    //End new filter
    			ob_start();
    			$this->output_sitemap_index( $urls, $comment );
    			return ob_get_clean();
    		}
    
    		/** Return an XML sitemap as a string. **/
    		function build_sitemap( $urls, $comment = '' ) {
    //This is the new filter: aiosp_sitemap_urls_filter gives an array with the urls.
    $urls = apply_filters( $this->prefix . 'urls_filter', $urls,$args);
    //End new filter
    			ob_start();
    			$this->output_sitemap( $urls, $comment );
    			return ob_get_clean();
    		}

    With this you may add any number of links to the sitemap, in my case using the url rewriting for the lang in the path (/en/,/fr/).

    Also i’ve seen the social plugin understandably doesn’t properly work when i’m using the custom language url. Right now it doesn’t retrieve the correct image for the page. Is there any filters i may use to check everithing is ok?

    https://wordpress.org/plugins/all-in-one-seo-pack/

  • The topic ‘AIOSP – Add urls to the sitemap by plugin.’ is closed to new replies.
Skip to toolbar