WordPress.org

Ready to get started?Download WordPress

Forums

WordPress SEO by Yoast
Switch XML Sitemap image URLs to CDN (nextgen images) (6 posts)

  1. chillmen
    Member
    Posted 1 year ago #

    I use this code to change images link in my sitemap to cdn one:
    function wpseo_cdn_filter( $uri ) {
    return str_replace( 'http://example.com', 'http://cdn.example.com', $uri );
    }
    add_filter( 'wpseo_xml_sitemap_img_src', 'wpseo_cdn_filter' );

    It is working for post's images but not for nextgen gallery images (inside pages).
    I still have example.com instead of cdn.example.com
    Does this code work only for post's images?
    Any idea how to fix this?
    Thanks

    http://wordpress.org/extend/plugins/wordpress-seo/

  2. jimmyg164
    Member
    Posted 1 year ago #

    Hi Chillman

    where do you add add the code

    cheers
    Jimmy

  3. chillmen
    Member
    Posted 1 year ago #

    You should add this code to functions.php file (inside your theme folder)
    Here is the link to yoast website, get more infos about this code:
    http://yoast.com/wordpress-seo-api-docs/

  4. jimmyg164
    Member
    Posted 1 year ago #

    cheers dude

  5. inquiztr
    Member
    Posted 1 year ago #

    I just noticed that my image urls in the sitemap were not pointing to my CDN. Thanks for your tip, I added the code and its fine now.

    Just curious, why is this not automated by Yoast's plugin?

  6. jimmyg164
    Member
    Posted 1 year ago #

    Hi In webmaster tools if i want to add a sitemap the only option is to add it in the root eg

    cdn.mobbly.com but my sitemap exists on the root of mobbly.com as such I have no images indexed it webmaster tools under mobbly.com

    I have added cdn.mobbly.com but can not add a sitemap

    any ideas

    kind regards

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic