When optimizing your website for SEO, you are trying to give Google the right signals so that it can index your website better. An optimized XML sitemap is one of those signals that can lead to faster indexing and higher rankings.
What is an XML Sitemap and why do you need it?
In simple terms, an XML sitemap is a file that lists all important pages of your website that search engine crawlers should know about.
Even if you don’t have a sitemap, they are still able to index your website but having a sitemap makes their job easier and also it gives you the opportunity to let them know about pages and parts of your website the may not discover easily.
There are different kind of sitemaps, you can submit a sitemap for your posts, images and videos.
When is a sitemap really important?
- For websites with many pages, a sitemap helps search engines discover pages that are new or updated.
- For websites that don’t use good internal linking practices a sitemap is a great way to give information to crawlers about your website pages.
- For new websites that don’t have many incoming links, a sitemap will server as a discovery tool.
How to create an XML Sitemap?
There are many ways to create an XML sitemap. Many platforms have this functionality built-in but even if they don’t, it’s easy to create one and take advantage of the benefits.
To check if your website has a sitemap you can open a new browser window and navigate to http://www.yourdomain.com/sitemap.xml.
It is necessary to understand that a sitemap is not a static file but it needs to be updated automatically when a new page is added to your website or when changes are made to existing pages.
For this reason, you should look for automated ways to create a sitemap.
For non-WordPress websites, the best way to create a sitemap is to search Google for plugins or software that are integrated to your platform and generate sitemaps according to Google guidelines.
For WordPress websites, there are many free plugins to help you. I will outline below 2 plugins that I am using for my sitemaps.
The first one is Google sitemap generator and the other one is Yoast SEO.
Google Sitemap Generator – You can download and install the plugin from the WordPress plugin repository. After you activate the plugin, there are a number of options to configure in SETTINGS / XML-SITEMAP.
Yoast SEO – If you already have yoast SEO installed then you don’t need another plugin to create your XML sitemap but you can configure yoast SEO to do the job.
What to include in your XML sitemap for maximum SEO?
Before getting into the actual configurations you need to make to the above plugins, it is important to understand what you should include in your XML sitemap for maximum SEO.
By default, the plugins will include all your website pages, posts, tags, archives, media etc. but this is not what we want for SEO purposes. Here are the guidelines:
- Include in your sitemap the pages (and that includes posts as well), that are important for your website. These are the pages that have high quality content and are more likely to bring organic traffic to your website.
- Exclude pages that have duplicate content. For WordPress websites good candidates are archive pages, tag pages and author pages.
- Exclude pages with ‘thin content’. When it comes to optimizing a website for search engines, you don’t want to submit in their index pages that are of low quality. It’s not a numbers game, meaning that it’s not a matter of how many pages you have in the index but how many ‘good’ pages are in the index.
A good way to separate your ‘good pages’ from the ones that you don’t want to include in your sitemap is to either ‘no-index’ the pages or add them to a category and exclude the particular category from the sitemap file.
- Organize your sitemap into sub-sitemaps. This has the additional advantages of making sitemaps smaller and faster to process. Both plugins suggested above generate the sitemap in this format.
- Submit a separate sitemap for your images and video.
- Add your sitemap in robots.txt. I have explained before how to SEO your robots.txt and in addition to that, you can also add a line (as shown below) to help search engines find your sitemap file easier.
Add this at the top of your robots.txt:
Sitemap: http://www.yourdomain.com/sitemap_index.xml or http://www.yourdomain.com/sitemap.xml depending on the actual URL of your sitemap.
If you are using the main sitemap, sub-sitemap format then you only need to add your main sitemap in the robots.txt.
- Include only URLS that Google can access. If you have pages that are blocked by robots or are behind a password-protected area, do not include those pages in the sitemap.
- Make sure that your XML Sitemap includes the ‘last modification time’ field, a value that gives information to Google as to when a page was last modified. This is useful in cases where you want Google to re-index some pages of your website.
Creating an XML Sitemap with Google Sitemap Generator
As mentioned above, the first step is to download and install the plugin to your WordPress website. Once activated click the XML-SITEMAP option under SETTINGS.
You can leave the default settings for the rest of the options except SITEMAP CONTENT.
As you can see in the above screenshot, I excluded from the sitemap the archive pages, author pages and tag pages. In addition, I have the ‘last modification time’ option checked.
Once you are done with the above settings, scroll down and click the UPDATE OPTIONS button.
You can now navigate to http://yourdomain.com/sitemap.xml, check your sitemap and if everything is OK, you can submit it to Google.
Creating an XML Sitemap with Yoast SEO Plugin
One of the nice features of Yoast SEO is the Sitemap functionality. If you have the plugin installed and activated, click XML SITEMAPS under SEO.
The first thing to do is to ‘Enable the XML Sitemap functionality’ by clicking the checkbox at the top.
Next, go to POST TYPES and exclude posts types that are not important for your website (media pages for example). You need to do the same by visiting TAXONOMIES and exclude tags and possibly categories.
Once you are done go back to the GENERAL tab, SAVE SETTINGS and check your sitemap by clicking the XML SITEMAP button.
How to submit your XML sitemap to Google?
There are two ways to ensure that Google will pick up your sitemap. The first way is to add it to the robots.txt (as explained above) and the second way is to submit your sitemap in Google Webmaster tools. For best results, you can use both methods.
To submit your XML sitemap in Google Search Console:
Login to Google search console (https://www.google.com/webmasters)
Click SITEMAPS under CRAWL.
Click the button ADD/TEST SITEMAP located in the top right corner.
Type in your sitemap filename (i.e. sitemap.xml) and click the SUBMIT SITEMAP button.
Once you do this you will see that the sitemap is Pending. Check back in a few days to see how many pages were submitted with your sitemap and how many pages are actually indexed.
Note: It is normal that Google will not index all your pages especially if you added in the sitemap pages that are not important.
When do you need to submit an RSS Feed to Google?
Besides submitting an XML sitemap, there are cases that you can submit an RSS feed to Google.
When you have a large website with lots of pages that change frequently (for example a News website), you can make use of an RSS feed to let Google know of new additions to the website. The RSS feed will be smaller and will only include the new pages (thus it will be processed faster) while your sitemap will include ALL your pages.
Conclusion and checklist
Having a valid XML Sitemap that search engines can read is important for SEO. Anything you can do to make their job easier and any ways you can use to give them more information about the structure and contents of your website will enhance your website’s presence in their index.
Creating an XML sitemap is easy since there are many plugins that automate the process for you.
Besides having a sitemap, if your website has a lot of content (pages, posts etc.) and if you have new additions on a daily basis, you can also submit your RSS feed to Google (the same way as you do with a sitemap) and thus speed up indexing your new content.