Need to exclude some pages from sitemap

#831999
  • Resolved Robin
    Rank Math free

    Hi,

    I want to exclude specific pages from my sitemap because they are just elements pages and layout pages that came with the theme. I don’t know how to do that. Specific ones are below in the sensitive data area.

    Also want to confirm that it is ok to remove them from the sitemap. I figure they are only for what the site looks like not for what people need to search for. Am I correct?

    THANKS!

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

    Thank you for reaching out to us. To exclude specific pages from your sitemap in Rank Math, you can follow these steps:

    1. Head to WordPress Dashboard → Rank Math SEO → Sitemap Settings → General.
    2. Scroll down to Exclude Posts and enter the ID of the post or page you want to exclude into the field. Remember to separate multiple IDs with a comma.
    3. Click Save Changes to apply the exclusion.

    Here is an example screenshot to guide you through the process:

    Enter the ID into the field and Save Changes

    Regarding your concern about excluding these pages, you are correct. If these pages are just elements and layout pages that came with the theme and are not essential for search engines to index, it is safe to exclude them from the sitemap. This way, you can have more control over what is indexed by search engines, ensuring that only the most relevant and valuable content appears in search results.

    If you have any more questions or need further assistance, feel free to ask.

    Thank you!

    Sources:
    How to Exclude Content From Sitemap » Rank Math
    How To Exclude Rank Math Sitemaps from Caching » Rank Math

    Hello,

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

    You can either completely delete/unpublish those pages, or set them to noindex and they will be removed from the sitemap.

    Here is guide where we show how to exclude posts and pages data from your sitemap: https://rankmath.com/kb/exclude-content-from-sitemap/

    Looking forward to helping you.

    Robin
    Rank Math free

    Where do I specifically list these or mark them as no index one by one? where are the page IDs in WordPress? THANKS!

    Hello,

    Please follow this guide to set the pages to noindex: https://rankmath.com/kb/how-to-noindex-urls/

    Alternatively, here’s how to get your WordPress page ID.

    Navigate to Pages → All Pages, then locate the page. Proceed and open the page using the WordPress editor. Pay attention to the URL in your browser’s address bar, and you should see a ‘post=’ section followed by a number.

    The page ID is the number the arrow is pointing to. In the image above, the page ID is 134.

    This is the page ID you will use to exclude the page from the sitemap.

    Hope this helps, and please do not hesitate to let us know if you need our assistance with anything else.

    Thank you for choosing Rank Math.

    Robin
    Rank Math free

    Thank you!

    Hello,

    We are super happy that this resolved your issue. If you have any other questions in the future, know that we are here to help you.

    If you don’t mind me asking, could you please leave us a review (if you haven’t already) on https://wordpress.org/support/plugin/seo-by-rank-math/reviews/#new-post about your overall experience with Rank Math? We appreciate your time and patience.

    If you do have another question in the future, please feel free to create a new forum topic, and it will be our pleasure to assist you again.

    Thank you.

    Hello,

    We checked your sitemap, and none of the links you shared are on any of your sitemaps. In any case, you can use this code to set any URL to noindex. Modify it to fit your use-case:

    add_filter( 'rank_math/frontend/robots', function( $robots ) {
        $noindex_urls = array(
            '/elements/testimonials-3/',
            '/blog-layouts/',
            '/blog-single/',
            '/elements/service-element/',
            '/elements/social-media/',
            '/elements/price-list/',
            '/elements/progress-bar/',
            '/elements/slider/',
            '/elements/inner-row-column/',
            '/elements/images/'
        );
    
        foreach ( $noindex_urls as $url ) {
            if ( strpos( $_SERVER['REQUEST_URI'], $url ) !== false ) {
                $robots['index'] = 'noindex';
                break; // Stop checking once a match is found
            }
        }
    
        return $robots;
    });

    You can add more URLs to the $noindex_urls array.

    Don’t hesitate to let us know if you need help with anything else.

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

The ticket ‘Need to exclude some pages from sitemap’ is closed to new replies.