How do you add an XML sitemap to your site?
Like with all things WordPress, you use a plugin.
Two plugins stand above the rest, and I’ll provide an explanation of each so you can choose the right one for your site.
First, I have to suggest one of my favorite plugins, Yoast SEO.
Yoast SEO has had some controversial updates over the years, but the core product has always been excellent.
Why use Yoast SEO
Yoast SEO is a large plugin. If you want a quick and straightforward solution, or if you already have an SEO plugin, check out my next recommendation.
Otherwise, Yoast SEO is the best plugin for the job. In addition to handling sitemaps very well, it gives you a lot of control over your site’s SEO.
Did you know? Yoast SEO makes a ton of optimizations on your site automatically including proper pagination markup, canonicalization, and of course, adding sitemaps.
How to create a sitemap with Yoast SEO
Yoast enables the XML sitemap feature by default, and a sitemap is generated immediately upon installation.
Rather than creating one sitemap page, Yoast SEO creates a sitemap index. This is a page that links to a few XML sitemaps.
Here’s the settings page where you can enable/disable the various sitemaps.
Yoast SEO XML sitemap example
Here’s the sitemap index for Compete Themes.
I only keep a sitemap for the posts, pages, and help articles (for theme documentation). I find taxonomies redundant since the three sitemaps alone cover all the content on the site. This gives the search engine bots fewer links to crawl.
Google XML Sitemaps
Another great option for adding an XML sitemap to your site is the Google XML Sitemap plugin.
Before moving on, I want to point out that you can use this plugin for your sitemaps, and use Yoast SEO for other SEO features if you disable its sitemap feature.
Why use Google XML Sitemaps
Google XML Sitemaps is the highest-rated plugin of all time.
Like Yoast SEO, it automatically creates an XML sitemap index and updates dynamically as you publish new content. Google XML Sitemaps gives you more control over your sitemap’s configuration and also has options to “notify” search engines as new content is published.
How to create a sitemap with Google XML Sitemaps
Like Yoast SEO, all you have to do is install and activate the plugin.
Once activated, Google XML Sitemaps will create a sitemap index file linking to a variety of sitemaps. These sitemaps are constructed based on post types and dates. For instance, you’ll have a sitemap for each month for your posts as well as your pages.
The default configuration is probably best, but there are a lot of settings available to tweak your sitemaps.
Create your XML sitemap yet?
While both plugins are excellent for adding sitemap functionality to WordPress, I prefer Yoast SEO. I already use it for other optimizations, and the sitemaps are well organized and efficient.
Adding a sitemap to your site is easy – it only takes as long as installing one of these plugins.
If you have any questions about these plugins or adding an XML sitemap to your site, please post a comment below.