how can i set noindex for all urls which has ?

#127402
Viewing 11 replies - 1 through 11 (of 11 total)
  • Hello,

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

    Unfortunately, there is no option in Rank Math Free to add noindex to multiple pages/posts at once.

    To workaround this, you can make use of a filter to set all the posts on the post type to index/follow like so:

    add_filter( 'rank_math/frontend/robots', function( $robots ) {
         global $post;
         // filter for only a specific post type
         if(get_post_type() == "your_post_type_name_here"){
            $robots['index'] = "noindex";
            return $robots;
         }
         return $robots;
    });
    

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

    Hello where should I paste this code… should I goto edit plugin ??? Plz guide me

    Hello,

    You have to edit the code before pasting. It is for reference only. The code needs to go to your theme’s functions.php file.

    Hope that helps.

    Hello if you don’t mind should I paste the above code in my theme function.php ??

    Hello,

    Yes, after customizing the code, you’ll need to paste it in the very bottom line of your theme’s functions.php

    I hope that helps. Thank you, and please don’t hesitate to contact us if you need further assistance.

    So in the above code there is something to replace. “your_post_type_name_here” my posts are actually questions . Mine is a q & a community. So i want noindex for urls which has /?show=

    So that would be “your_post_type_name_here” for my site?

    Hello,

    That would require you to first check if the URL has a query paremeter(?) then add the noindex meta.

    If all you want is for such URLs to be excluded from SERPs, you can disallow bots from indexing query strings by placing directives that specify that in your robots.txt file. Here is an example:

    
    Disallow: /*?*
    

    You can add this to your robots.txt by heading to Rank math > General Settings > Robots.txt and once done, test if this is working using this tool: https://technicalseo.com/tools/robots-txt/

    Hope this helps.

    Yes it will eventually lead to indexing error. Like on website robots the code will be meta robots = index. And on robots.txt blocking that url. I’m saying robots to index that and blocking too.

    Hello,

    Yes, you would see errors in GSC for pages you set as noindex as well.

    Please note that having the above text in your robots.txt file will likely remove the pages from the index but it is not a guarantee.

    From here: https://developers.google.com/search/docs/advanced/robots/robots-faq

    With that said, we do not have an option to noindex product variations and I don’t think any other plugin offers that either. It is not needed, not required, and since you have a canonical URL present – it gives Google the right signals as to where the actual original source is. It is just that they are overriding that for some reason and it might be okay with time. But it is completely normal to have those in the index and there is nothing to be worried about.

    Hope that helps.

    like if you have this feature in your next update that will be really useful. if not in pro version. because google sometimes neglecting link rel=canonical tag. so its better them to set to noindex, simple using canonical.

    Hi,

    Google is sometimes known to include even pages set to noindex in SERPs if the pages seem to generate linked traffic on your site.

    It is not recommended to use more than one method to keep one page from indexing, for example having canonical and noindex on the same page, which is why Rank math doesn’t add canonical URLs to pages set to noindex. Here is an article you can refer on this: https://moz.com/blog/robot-access-indexation-restriction-techniques-avoiding-conflicts

    Hope this helps you

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

You must be logged in to reply to this ticket.