exclude archive page

#393888
  • Resolved Omri Shalom
    Rank Math free

    Hi

    My theme creates some archive pages, one of which is a portfolio page.

    I have a dedicated page for this so want to exclude the archive version as currently I have a duplicate in Google.

    But this isn’t a page so not sure how to exclude?

    I was able to do this with AIO SEO before I switched but cant work out how to do it with yours?

    Essentially, I don’t want to include archives and there seems to be no way of excluding this?

Viewing 7 replies - 1 through 7 (of 7 total)
  • I didnt realise this was going to create a thread. I’d like this to not be public please.

    Hello,

    Thank you for contacting Rank Math and bringing your concern to our attention. I’m sorry for any inconvenience this issue may have caused you.

    I’ve removed the URLs you have shared as requested.

    To exclude them in your sitemaps, head over to Rank Math > Sitemap Settings > Portfolio, and from there, disable this option

    Exclude

    I hope that helps.

    Thank you.

    That gets rid of all the portfolio pages, I just want to get rid of the portfolio archive page, not every portfolio page.

    Hello,

    Since it is the archive page of the portfolio pages, it will be automatically added to the sitemap.

    However, could you please try adding this filter on your site to remove it manually on your sitemap? Please update the yourdomain part to your actual website name:

    add_filter( 'rank_math/sitemap/entry', function ( $url, $type, $object ) {
    
            $urls_to_skip = array(
                    'https://www.yourdomain.com/portfolio/'
            );
    
            if ( isset( $url['loc'] ) && in_array( $url['loc'], $urls_to_skip ) ) {
                    return false;
            }
    
            return $url;
    }, 10, 3 );

    The filter should be added to your active theme’s functions.php file. Here’s another way to apply the filter using the rankmath.php file:
    https://rankmath.com/kb/filters-hooks-api-developer/#adding-filters-and-hooks-in-rank-math-php

    Let us know how this goes.

    Thank you.

    Hi

    Thanks for the reply. Tried this, cleared cache but the URL was still present in the sitemap.

    I’m happy to exclude the page instead and remove that from the sitemap. Only reason I’ve not done this so far, is doing this means I cant set a meta title and description on the archive page.

    Hello,

    Could you please follow these steps to flush the sitemap cache after adding the filter?

    1. Flush the Sitemap cache by following this video screencast:
    https://i.rankmath.com/pipRDp

    2. Exclude the Sitemap files of the Rank Math plugin in your caching plugin. The cache could be via a plugin or from the server. For plugins or Cloudflare, please follow this article:
    https://rankmath.com/kb/exclude-sitemaps-from-caching/

    If the URL is still showing, we might need to take a closer look at the settings. Please edit the first post on this ticket and include your WordPress & FTP logins in the designated Sensitive Data section.

    Please do take a complete backup of your website before sharing the information with us.

    Sensitive Data Section

    It is completely secure and only our support staff has access to that section. If you want, you can use the below plugin to generate a temporary login URL to your website and share that with us instead:

    https://wordpress.org/plugins/temporary-login-without-password/

    You can use the above plugin in conjunction with the WP Security Audit Log to monitor what changes our staff might make on your website (if any):

    https://wordpress.org/plugins/wp-security-audit-log/

    We really look forward to helping you.

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

The ticket ‘exclude archive page’ is closed to new replies.