How to noindex galleries created by rl_gallery?

#6815
  • Resolved Denis
    Rank Math free

    Hello,
    I just switched to Rank Math in order to give it a try, and trying to make sure that only content pages are indexed. In Yoast, I had the option to noindex galleries created by the Responsive Lightbox & Gallery plugin, but it seems to be missing from Rank Math.
    In the Titles & Meta settings, noindex is checked everywhere except posts & pages. Noindex is selected for Galleries. Noindex is also checked for Categories and Tags created by RL Gallery. I can however noindex those galleries individually when editing them through the Galleries menu.
    How can I make sure all those galleries are noindex? Thank you.

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

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

    I have just tested this issue on my end using the same plugin but the gallery is correctly set to “noindex” when this option is enabled on the Rank Math Titles & Meta settings as you can see below:
    IMG

    Please investigate whether you have another plugin that is modifying the robots meta on your site by performing the tests outlined on the following page: https://rankmath.com/kb/check-plugin-conflicts/

    Let me know how this goes. Thank you.

    ​​​​​​​

    Denis
    Rank Math free

    Hi Michael,
    I did some additional testing.
    In fact the settings work for new galleries: when I create a new one, it’s set to noindex. Existing galleries, however, remain index. How can I bulk set all of them to noindex?

    Hi Denis,

    Thanks for getting back to us.

    I am afraid that we do not have a bulk edit option but you can add some PHP code to your theme to modify the index meta for the gallery post type like so:

    /**
     * Allows filtering of the robots meta data.
     *
     * @param array $robots The meta robots directives.
     */
    add_filter( 'rank_math/frontend/robots', function( $robots ) {
            $url = $_SERVER["REQUEST_URI"];
            $isItGalleryPage = strpos($url, 'rl_gallery');
    	if ($isItGalleryPage!==false){
    		$robots['index'] = "noindex";
    	return $robots;
    	}
    	return $robots;
    });
    

    I hope this info helps. 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 ‘How to noindex galleries created by rl_gallery?’ is closed to new replies.