Browsing posts in: Wordpress

Creating a sitemap for your WordPress blog

Sitemaps expedite this process by providing search engine robots with a detailed map of your site. Instead of having to crawl your site manually by finding internal links to all your content, the crawler can instantly know where every public page in your website is located.

While by no means a magic bullet for SEO, sitemaps will improve the indexing of your site. And that means it’s more likely that all your posts and pages get included in search results.

They also allow you to provide search engines with optional information like when a page was last updated, how often a page changes, and how important a page is. This information can further help search engines optimize how they crawl your site.

XML vs HTML Sitemaps

XML sitemaps are the most common implementation. They’re exactly what I discussed above – a map dedicated almost entirely to search engines. Their data isn’t really useful to humans, so the only reason to create one is to boost your indexing.

HTML sitemaps, on the other hand, can be used by both humans and search engines. It’s an actual page on your website where humans and search engines can get a high-level overview of all the content your site offers. Search engines can still crawl this page, but it also gives some curious visitors a better user experience.

So which type should you use?

The answer is BOTH. It’s not an either/or question. They don’t conflict and both types offer benefits. If you don’t believe me, check out former Google SEO guru Matt Cutts talking about why you should include both XML and HTML sitemaps:

XML Sitemap – plugins

Given the popularity of SEO plugins, there’s a good chance you already have all the necessary functionality to create an XML sitemap. If you use JetpackYoast SEO, All in One SEO, Google Sitemaps, or SEOPressor, you just need to find the relevant plugin setting to set up your XML sitemap.

1. Jetpack

Jetpack allows you to generate such files thanks to the Sitemaps module.

If you already have the plugin activated & running, ensure you are using the latest version of Jetpack.

Now, head to Jetpack > Settings > Engagement & look for module call Sitemaps & activate it.

Unlike other sitemap plugins for WordPress, here you don’t need to configure anything. This is a limitation for big WordPress sites but a new or medium size blog; you don’t need to configure anything apart from submitting your sitemap to search engines.

Once you activate the module, Jetpack will generate two different sitemaps for you: a sitemap listing all your public posts and pages, and a News sitemap built specifically for Google News:

  • Normal sitemap:
  • News Sitemap:

Sitemap generated by Jetpack WordPress

2. Yoast SEO

Yoast SEO you just need to navigate to SEO → XML Sitemaps to enable and configure it:


One nice feature with Yoast SEO’s sitemap tool is the ability to include media attachments in your XML sitemap:


When enabled, this can boost your traffic from Image Search by increasing the indexing of your media uploads.

404 Errors:

How do I know if I need to add the redirect rules?

The Yoast SEO XML sitemap URL uses a pretty permalink of but, behind the scenes, this URL also has a non-pretty permalink of If you can load and see the sitemap using the non-pretty permalink, your server is not setup to redirect and, thus, you’ll need to add redirect rules.

  • Using NGINX:
    In some cases, you may need to add server level redirects if you receive an NGINX server error or a wrong page when loading the XML sitemaps.Basic Code
    # Rewrites for Yoast SEO XML Sitemap
    rewrite ^/sitemap_index.xml$ /index.php?sitemap=1 last;
    rewrite ^/([^/]+?)-sitemap([0-9]+)?.xml$ /index.php?sitemap=$1&sitemap_n=$2 last;

    Expanded Code
    #Yoast SEO Sitemaps
    location ~ ([^/]*)sitemap(.*).x(m|s)l$ {
    ## this redirects sitemap.xml to /sitemap_index.xml
    rewrite ^/sitemap.xml$ /sitemap_index.xml permanent;
    ## this makes the XML sitemaps work
    rewrite ^/([a-z]+)?-?sitemap.xsl$ /index.php?xsl=$1 last;
    rewrite ^/sitemap_index.xml$ /index.php?sitemap=1 last;
    rewrite ^/([^/]+?)-sitemap([0-9]+)?.xml$ /index.php?sitemap=$1&sitemap_n=$2 last;
    ## The following lines are optional for the premium extensions
    ## News SEO
    rewrite ^/news-sitemap.xml$ /index.php?sitemap=wpseo_news last;
    ## Local SEO
    rewrite ^/locations.kml$ /index.php?sitemap=wpseo_local_kml last;
    rewrite ^/geo-sitemap.xml$ /index.php?sitemap=wpseo_local last;
    ## Video SEO
    rewrite ^/video-sitemap.xsl$ /index.php?xsl=video last;
  •  Using Apache:

    You should go to your .htaccess file ( How to Guide available here.) and add the following code before the main WordPress rewrite rules:
    # Yoast SEO - XML Sitemap Rewrite Fix
    RewriteEngine On
    RewriteBase /
    RewriteRule ^sitemap_index.xml$ /index.php?sitemap=1 [L]
    RewriteRule ^locations.kml$ /index.php?sitemap=wpseo_local_kml [L]
    RewriteRule ^geo_sitemap.xml$ /index.php?sitemap=geo [L]
    RewriteRule ^([^/]+?)-sitemap([0-9]+)?.xml$ /index.php?sitemap=$1&sitemap_n=$2 [L]
    RewriteRule ^([a-z]+)?-?sitemap.xsl$ /index.php?xsl=$1 [L]
    # END Yoast SEO - XML Sitemap Rewrite Fix

3. All in One SEO

With All in One SEO plugin installed, just navigate to All in One SEO → XML Sitemap:


4. Google XML sitemap

After you install the plugin, you can configure it by going to Settings → XML-Sitemap:


Here’s what you’ll definitely want to configure on that page:

  • Post priority: Set how you want to calculate posts’ crawling priorities. You can have the plugin automatically calculate priority by the number of comments, or manually set the priority later on.
  • Sitemap content: Choose what types of content get included in your sitemap. For example, if you want to exclude category archives, you just need to uncheck that box.
  • Change frequencies: Set how often each type of content gets changed. This gives search engines an idea of how to prioritize their crawling. For example, you’ll definitely want to set the page which displays your recent posts to be crawled daily.
  • Priorities: Lets you set manual crawling priorities for different content. You definitely want your homepage and posts page (if different) to be high priority.

404 Errors:

  • Using NGINX:
    In some cases, you may need to add server level redirects if you receive an NGINX server error or a wrong page when loading the XML sitemaps.Basic Code
    # Rewrites for Yoast SEO XML Sitemap



Tell Search Engines About Your XML Sitemap

Now that you’ve created your sitemaps, there’s one more thing you need to do:

Tell search engines exactly where they can find it.

By showing search engines where you keep your sitemap, you ensure they find it, which means they’ll know whenever you publish changes to it and your site.

To submit your sitemap to Google, you’ll need to sign up at Google Search Console and follow their instructions for submitting a sitemap.

The process is quite similar for submitting your sitemap to Bing. You’ll need to sign up at Bing Webmaster Tools and then submit your sitemap by following their directions.