Noindex Post Type Page but index Posts

#764849
  • Resolved Anonymous
    Rank Math free

    Hello! I would like to set my custom post type page (e.g. /projects) as noindex but I want all the listed posts/projects to this post type to be indexed (e.g. /project/example). How could this be possible?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hello! We appreciate you reaching out with your query.

    To achieve this, you can set the custom post type page to NoIndex while keeping the listed posts/projects within this post type indexed. Here’s how you can do it:

    1. Navigate to WordPress Dashboard → Rank Math SEO → Titles & Meta → Posts.
    2. Scroll down to find the Post Robots Meta option and enable it.
    3. Choose the No Index option to set the custom post type page as NoIndex.

    By following these steps, you can ensure that the custom post type page is set as NoIndex while the listed posts/projects within this post type remain indexed.

    If you have any further questions or need assistance, please feel free to ask. Thank you for your understanding and patience!

    Sources:
    How to Noindex URLs With Rank Math » Rank Math
    How to Noindex URLs With Rank Math » Rank Math
    How to Noindex URLs With Rank Math » Rank Math
    How to NoIndex All Posts in a Category » Rank Math
    Using Rank Math’s ‘Quick Actions’ Admin Menu Item

    Hello,

    Thank you for contacting Rank Math support.

    1. You can set the individual projects to index from Rank Math > Title & Meta > Post Types: > Projects > Project Robots Meta.

    2. You can set the Project’s archive URL to noindex using the Rank Math filters. Here’s an example code you can use:

    /**
     * Allows filtering of the robots meta data.
     *
     * @param array $robots The meta robots directives.
     */
    add_filter( 'rank_math/frontend/robots', function( $robots ) {
    	// Get the current URL
    	$current_url = home_url( $_SERVER['REQUEST_URI'] );
    
    	// The URL you want to exclude
    	$exclude_url = 'https://youdomain.com/projects/';
    
    	// Compare the URLs and add noindex tag if they match
    	if ( $current_url == $exclude_url ) {
    		$robots['noindex'] = 'noindex';
    	}
    
    	return $robots;
    });

    If you want to exclude multiple URLs at the same time, you can modify

    $exclude_url = 'https://youdomain.com/projects/';
    

    to

    $exclude_url = array(
    		'https://youdomain.com/projects/',
    		'https://youdomain.com/another-page-here/',
                    'https://youdomain.com/yet-another-page/'
    	);

    We hope this helps you resolve the issue. Don’t hesitate to contact us again with any other questions or concerns regarding Rank Math. We are always happy to help.

    Thank you for choosing Rank Math!

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

The ticket ‘Noindex Post Type Page but index Posts’ is closed to new replies.