If you’re implementing programmatic SEO on your website, you must be creating a lot of pages. And it may become a challenge to automatically add all new pages to your XML sitemap index so that Google and other search engine bots can easily discover them.
However, usually, it’s straightforward to automatically keep adding new pages to the sitemap. Sometimes, it might not be that easy.
Let me explain and demonstrate each situation…
Handing Sitemaps for WordPress Sites
If you are doing pSEO in WordPress by using the plugin WP All Import, it’s easy to keep your XML sitemap updated. Most SEO plugins have inbuilt functionalities to auto-create sitemaps and also keep them updated, you may need to change some settings, though.
Allow me to explain some famous SEO plugins out there…
1. Yoast SEO
Yoast SEO is the best plugin that handles sitemaps with style. I have tested it with more than 50,000 pages and it works great.
If you have the plugin already installed on your website, most probably you don’t need to do anything, it’s already working. But make sure to check the section shown in the above screenshot that the XML Sitemaps feature is enabled.
You can visit yourwebsite.com/sitemap.xml to see the created sitemap.
2. Rank Math SEO
While the Rank Math SEO plugin can also automatically create the sitemap considering all pages on the site, it struggles to update the sitemap when you’re using custom post types.
As highlighted in the above screenshot, you will find this under Sitemap Settings » General and make sure it’s turned on. Again, your sitemap will be visible at yourwebsite.com/sitemap.xml
.
To automatically update the sitemap when new pages are published under a custom post type, Rank Math suggests adding the following code in your nginx.conf
file. The same notice is also shown at the top of the sitemap page, as you can see in the screenshot above.
# START Nginx Rewrites for Rank Math Sitemaps
rewrite ^/sitemap_index\.xml$ /index.php?sitemap=1 last;
rewrite ^/([^/]+?)-sitemap([0-9]+)?.xml$ /index.php?sitemap=$1&sitemap_n=$2 last;
# END Nginx Rewrites for Rank Math Sitemaps
If some pages are still excluded from the sitemap, this video will help you identify and resolve the issue.
If you’re not using either of the SEO plugins on your website, there are other dedicated plugins like the XML Sitemap Generator plugin that you can use.
#ResearchOnDemand 🎉
Programmatic SEO Ideas for Your Niche
Hours of research containing programmatic SEO areas, potential keywords list, page template suggestions, and much more – for the said niche.
Handling Sitemaps for Non-WordPress Sites
The process of creating sitemaps for sites that are not built in WordPress varies on the tech stack you’re using.
For example, if you’re using Next.js for creating your website, here’s a quick tutorial for adding a sitemap to your project. Similarly, if you’re using a CMS like Webflow, there are tutorials for adding sitemaps as well.
In fact, I created a programmatic SEO site using 11ty and just added the code shown in the above screenshot in a sitemap.md file to create the sitemap. It also automatically updates every time the site builds.
If you’re building a static website that will not be changing that frequently, you can also use a tool like XML Sitemaps to create the sitemap and download the .xml
file. You can later upload the file to the root directory of your website.
As per Google recommendations, a single sitemap file should contain a maximum of 50,000 URLs and should be less than 50 MB in filesize. It should also be encoded as UTF-8. If you have more URLs, you can split them into multiple sitemap files.
That’s it.
Got some questions? Please let me know in the comments below.
Leave a Reply