Hello,
Thank you for reaching out to us with your concern about the sitemap configuration on your website. We appreciate your kind words about our plugin.
To ensure that the archive page is included in the Pages sitemap instead of the Posts sitemap, you can follow these steps:
-
Exclude the Archive Page from the Posts Sitemap:
- Head to WordPress Dashboard → Rank Math SEO → Sitemap Settings → General.
- Scroll down to Exclude Posts and enter the ID of the archive page into the field.
- Remember to separate multiple IDs with a comma.
- Click Save Changes.
-
Include the Archive Page in the Pages Sitemap:
- Navigate to WordPress Dashboard → Rank Math SEO → Sitemap Settings → Pages.
- Ensure that the Include in Sitemap option is enabled for pages.
- Save any changes if needed.
By following these steps, you can exclude the archive page from the Posts sitemap and include it in the Pages sitemap as desired.
If you encounter any further issues or need additional assistance, please feel free to reach out to our dedicated support team by clicking here. We are available 24/7, 365 days a year to assist you.
Thank you for using Rank Math!
Sources:
Why Isn’t My URL Included in the Sitemap? » Rank Math
How to Exclude Content From Sitemap » Rank Math
How to Configure Sitemaps in Rank Math – Best Settings and Tips
Why the Sitemap_Index.xml is Throwing a 404 Error » Rank Math
Hello again, super quick reply.
I excluded the id of the page from the posts sitemap.
As you can see from gyazos the pages sitemap is enables, but the archive is not showing…
Any possble solution?
Hello,
Thank you for your patience.
Please note that the post archive is not a WordPress default page, so it won’t be included in the page sitemap automatically.
However, to remove it from your post sitemap, please add this filter on your site:
add_filter( 'rank_math/sitemap/post_type_archive_link', function( $archive_url, $post_type ){
if ($post_type == 'post'){ // match to the actual post type name
$archive_url = false;
}
return $archive_url;
}, 10, 2 );
Then to add it to your page sitemap, add this filter as well:
add_action( 'rank_math/sitemap/page_content', function() {
return '<url>
<loc>https://www.pressvibes.com/archive/</loc>
<lastmod>2024-02-29T20:20:20+00:00</lastmod>
</url>';
});
And here’s how you can add a filter/hook to your WordPress site:
https://rankmath.com/kb/wordpress-hooks-actions-filters/
Once done, follow these steps to flush your sitemap cache:
https://i.rankmath.com/pipRDp
Hope that helps.
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.