Adding extra sitemap_own.xml to sitemap_index.html

  • Hi there,

    you build a great plugin!
    One question (could not found anything in the tickets and knowledge base…).

    Is it possible to add an own / extra sitemap_own.xml to the sitemap_index.xml like yoast offers with it wpseo_sitemap_index
    e.g.

    */
    function my_wpseo_sitemap_index()
    {
    // Add custom item to sitemap index
    $extraSitemaps = ‘
    <sitemap>
    <loc>’ . get_bloginfo(‘url’) . ‘/sitemap/sitemap_shops_dach.xml</loc>
    <lastmod>’ . date(‘Y-m-d’) . ‘T’ . date(‘H:i:s+00:00’) . ‘</lastmod>
    </sitemap>
    ‘;
    return $extraSitemaps;
    }

    add_filter(‘wpseo_sitemap_index’, ‘my_wpseo_sitemap_index’);

    Thanks a lot and best regards
    Matthias

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hello,

    Thank you for contacting Rank Math today.

    This feature is available in the plugin. You will only need to make use of the following similar filter in Rank Math:

    /**
     Filter to add extra URLs to the XML sitemap by type.
     *
     Only runs for the first page, not on all.
     *
     @param string $content String content to add, defaults to empty.
     */
     add_action( 'rank_math/sitemap/{$type}_content', function() {
     return '         https://rankmath.com/some-custom-url/
             2020-02-20T20:20:20+00:00     
    ';
     }); 

    Looking forward to helping you. Thank you.

    ​​​​​​

    Thanks but I do not want to add a url (post or page) to an existing sitemap.xml, I want to add my own (created by me) xml to the sitemap_index.xml:

    see bold entry below.

    Sitemap Last Modified
    https://xyz.com/post-sitemap.xml
    2016-05-29 16:25 +00:00
    https://xyz.com/page-sitemap.xml
    2018-11-28 15:09 +00:00
    https://xyz.com/popupbuilder-sitemap.xml
    2019-07-08 16:13 +00:00
    https://xyz.com/category-sitemap.xml
    2016-05-29 16:25 +00:00
    https://xyz.com/sitemap_shops_dach.xml
    2016-05-29 16:25 +00:00

    Is this possible?

    Hello,

    Thank you for contacting Rank Math and sorry for the delay.

    The same filter can be used for this requirement. Please note that you need to replace {$type} with either post or page or any other custom post type that you want to register and then add the URLs using some custom logic to an array and return it.

    Looking forward to helping you. Thank you.

    ​​​​​​

    Hello,

    Since we did not hear back from you for 15 days, we are assuming that you found the solution. We are closing this support ticket.

    If you still need assistance or any other help, please feel free to open a new support ticket, and we will be more than happy to assist.

    Thank you.

Viewing 3 replies - 1 through 3 (of 3 total)

The ticket ‘Adding extra sitemap_own.xml to sitemap_index.html’ is closed to new replies.