include product archive paginated pages in sitemap

#628398
  • Resolved Anonymous
    Rank Math free

    Hello,

    I hope this message finds you well. I’m looking to include the product archive paginated pages in our sitemap to optimize caching. While I’m aware of Google’s recommendations against this, my primary intention is to enhance our cache performance. I’m currently using the OpenLiteSpeed service and am hoping to set up a crawler to refresh the cache for all archive pages every 4 hours. If it’s possible to have two separate sitemaps – one dedicated for caching and the other for Google’s reference – that would be ideal.

    Thank you for your assistance on this matter.

    Warm regards,

    Mohammad

Viewing 1 replies (of 1 total)
  • Hello,

    Thank you for contacting Rank Math support. We’re sorry for any trouble you’re having with adding paginated pages to your sitemap.

    As you may already know, adding paginated pages to your sitemap is not recommended for SEO reasons, as it can create duplicate content issues and confuse search engines. However, we understand that you have a different goal in mind, which is to improve your cache performance.

    In that case, you have a couple of options to try:

    One option is to use a filter that we provide to add extra URLs to your sitemap. This filter allows you to specify any URL that you want to include in your sitemap, regardless of whether it is a paginated page or not. You can find more details on how to use this filter here. Here is an example of the code that you can add to your site‘s functions.php or rankmath.php file:

    /**
     * Filter to add extra URLs to the XML sitemap by type.
     *
     * Only runs for the first page, not on all.
     *
     * @param string $content String content to add, defaults to empty.
     */
    add_action( 'rank_math/sitemap/{$type}_content', function() {
      return '<url>
        <loc>https://yoursite.com/shop/1/</loc>
        <lastmod>2020-06-10T20:20:20+00:00</lastmod>
      </url>';
    });

    Another option is to create a separate sitemap for caching purposes only. You can learn how to create a custom sitemap using Rank Math here.

    We hope this helps you achieve your desired outcome. If you have any other questions or issues, please let us know – we’re always happy to help.

    Thank you for choosing Rank Math.

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

The ticket ‘include product archive paginated pages in sitemap’ is closed to new replies.