Noindex for paginated pages

#50263
  • Resolved Aly Dee
    Rank Math free

    Hello,

    I was wondering if there was a way to include or exclude certain paginated archives for noindex/nofollow. For example, if I wanted to noindex the paginated pages on my main blog page where it shows ALL of my posts, but allow paginated pages to be indexed for categories? I don’t want to initiate noindex for all paginated pages, just every one except for the categories. I would also have the authors, dates, and tags archives disabled/noindexed. My goal is to have my categories indexed, but minimize duplicate content. Or any other workarounds that you may know of?

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

    Thank you for contacting Rank Math today.

    I am afraid that we don’t have an option to configure this on the admin interface but you could come up with some custom code to target the kind of paginated pages that you would like indexed using the following filter on your theme’s functions.php file:

    /**
     * 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.

    ​​​​​​​

    Hello,

    I’m not really a code person. Could I do something like this with a code snippets plugin?

    Hi Aly,

    Thanks for the reply.

    Yes you can register this using the code snippets plugin. Here is a sample code that you can add to this plugin:

    /**
     * Allows filtering of the robots meta data.
     *
     * @param array $robots The meta robots directives.
     */
    add_filter( 'rank_math/frontend/robots', function( $robots ) {
          if(is_paged() && is_category()){
              $robots['index'] = "index";
              $robots['follow'] = "follow";
          }
    	return $robots;
    });

    I hope this 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 ‘Noindex for paginated pages’ is closed to new replies.