Generate pages are not on sitemap

#106842
  • Resolved Duval Grégory
    Rank Math pro

    Hi

    I use script to generate pages that are not in WordPress. The links are in my pages, but the sitemap doesn’t take it. Is there another way to add it without use the functions.php : around 200 pages…

    Thank You

Viewing 1 replies (of 1 total)
  • Hello,

    Thank you for contacting Rank Math and sorry for any inconvenience that might have been caused due to that.

    Rank math automatically adds pages set to index and existing on your site to the sitemap. If your pages don’t exist on your site under WordPress dashboard > Pages as published then the only other way to add them to sitemap is using the following filter in your functions.php file:

    
    /**
     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 '<url>
    <loc>https://rankmath.com/some-custom-url/</loc>
    <lastmod>2020-06-10T20:20:20+00:00</lastmod>
    </url>';
    });
    

    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 1 replies (of 1 total)

The ticket ‘Generate pages are not on sitemap’ is closed to new replies.