Custom Post Type Archive Pages: Remove from Sitemap + No Index

#43394
  • Resolved Dave
    Rank Math free

    I’d like to remove the archive page for a custom post type from the sitemap, as well as apply a no index meta tag to it. I couldn’t find anywhere to set this.

    Does anyone know where I could find a setting to do this?

    Thanks for your time 🙂
    Dave

Viewing 6 replies - 1 through 6 (of 6 total)
  • Todd
    Rank Math free

    Hi Dave,

    Thanks for getting in touch with us.

    You can remove certain posts/pages/CPTs from Sitemap by adding them to the exclusion list at WordPress Dashboard > Rank Math > Sitemap Settings.

    You can noindex CPTs from WordPress Dashboard > Rank Math > Titles & Meta > *your CPT* > Robots meta.

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

    Dave
    Rank Math free

    Todd,

    Thanks for the quick reply. I think you’re referring to the two places that I’ve included screenshots of below.

    The problem is that both refer to single posts. I want to exclude the archive page, but INCLUDE the single posts for the CPT.

    The sitemap settings ask for a post ID, but the archive page doesn’t have a post ID.

    The robots meta section explicitly says that the settings are for single posts.

    And I missing something? Are these not the areas you’re referring to?

    null

    null

    Dave
    Rank Math free
    Michael Davis
    Rank Math pro

    Hello,

    Thank you for contacting Rank Math today.

    In order to make this work, you would need to write some custom code to target the archive page and set this to noindex using the following filter:

    /**
     * Allows filtering of the robots meta data.
     *
     * @param array $robots The meta robots directives.
     */
    add_filter( 'rank_math/frontend/robots', function( $robots ) {
    	return $robots;
    });

    Looking forward to helping you. Thank you.

    ​​​​​​

    Dave
    Rank Math free

    Got it. Thanks Michael.

    Todd
    Rank Math free

    Hello Dave,

    We are so glad to be of help. We are always here if you need us in the future.

    Hey, if it isn’t too much to ask for – would you mind leaving us a review here?

    https://wordpress.org/support/plugin/seo-by-rank-math/reviews/#new-post

    It only takes a couple of minutes but helps us tremendously.

    It would mean so much to us.

    Thank you.

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

The ticket ‘Custom Post Type Archive Pages: Remove from Sitemap + No Index’ is closed to new replies.