Set nofollow to members page

#602032
  • Resolved Miguel
    Rank Math free

    Hi, I need to set the nofollow meta tag to the members page (/members/) but in the rankmath settings there is no option for those pages, also using the robot.txt I’ve set the page as noindex if possible I want this to be set from rankmath too. The plugin that generates those members pages is buddyboss platform.

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

    Thank you for contacting Rank Math support and we apologize for the inconvenience.

    This would depend on whether the /members/ URL is a real page that you can edit or not. Here are the steps to follow for both cases:

    • If the /members/ URL is a real page that you can edit, then you can go to the page editor and look for the Rank Math meta box. There, you can change the settings to allow the page to be indexed by search engines. You can also customize other aspects of the page’s SEO, such as the title, description, keywords, etc.
    • If the /members/ URL is not a real page that you can edit, then you will need to use some code to change the settings for that URL. You can use this filter from Rank Math’s documentation to set that URL to index: https://rankmath.com/kb/filters-hooks-api-developer/#change-robots-meta. You will need to add this code to your theme’s functions.php file or use a plugin like Code Snippets to insert it.

    We hope this helps you index the /members/ URL on your website. If you have any other questions or concerns regarding Rank Math, please feel free to contact us again.

    Thank you for choosing Rank Math!

    Miguel
    Rank Math free

    Hi Anthony, it’s the latter case, the page is auto-generated /members/{username} what do I need to modify from the code you pointed out? Or it just works like that?

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

    Hello,

    The filter should be customized further to apply to those pages.

    Here’s the filter you can use to achieve that:

    add_filter( 'rank_math/frontend/robots', function( $robots ) {
    	$url = home_url( $_SERVER['REQUEST_URI'] );
    	if( (strpos($url,"/members/") !== false) )  {
    		$robots["index"] = 'noindex';
    		$robots["follow"] = 'nofollow';
    	}
    	return $robots;
    });

    Also, please remove the noindex or disallow rule added in your robots.txt so search engines would know that those pages are set to noindex.

    Let us know how this goes.

    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 ‘Set nofollow to members page’ is closed to new replies.