When optimizing your website for SEO, one of your goals is to provide 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 serve 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 can generate sitemaps according to Google guidelines.
For WordPress websites, there are many plugins to help you. I will show you below step-by-step instructions on how to create and optimize your XML sitemap using Yoast SEO.
What to include in your XML sitemap for maximum SEO?
Before getting into the implementation details, 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.
The most important sitemap optimization guidelines are:
- 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 (and pages) from the sitemap file.
- Organize your sitemap into sub-sitemaps. This has the additional advantages of making sitemaps smaller and faster to process.
- Submit a separate sitemap for your videos (if applicable).
- 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 the location of your sitemap to help search engines find your sitemap file easier.
- 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 Yoast SEO Plugin
One of the nice features of Yoast SEO is the Sitemap functionality.
If you have the plugin installed and activated, the first thing to do is to ‘Enable the XML Sitemap functionality’ by going to Yoast SEO – > GENERAL – > FEATURES -> XML SITEMAPS.
The next step is to configure what to include in your XML sitemap.
Click SEARCH APPEARANCE and then CONTENT TYPES.
For each of the content types, you need to decide if this is something you want to include in your sitemap.
If you set “Show posts in search results?” to YES, then the particular content type will be included in your sitemap, if you choose NO, it will not be included.
In most situations, you only need to include your posts, pages and products (in case of ecommerce websites) and exclude everything else.
Next, you need to select TAXONOMIES and do the same. In other words, you need to select which taxonomies you want to be included in your sitemap or not.
In a normal scenario, you should only include your post and product categories and exclude anything else like post tags or pages that don’t have unique content of their own.
The next and final step is to go to ARCHIVES and disable Author and Date Archives.
Where is my XML Sitemap?
To view your sitemap, click SEE THE XML SITEMAP from GENERAL / FEATURES (first screenshot above), or open a new browser window and navigate to https://yourwebsite.com/sitemap_index.xml
As you can in the screenshot above, the plugin created one sitemap per content type.
If you click on any of the links, you will also see that it contains info for images as well so you don’t need to create a different sitemap to submit your images to Google.
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 and the second way is to submit your sitemap in Google Search Console.
For best results, you can use both methods.
Add your sitemap in robots.txt
Edit your robots.txt file as explained here, and add a line at the end to include your sitemap as shown below.
If you don’t know what is robots.txt and what does it do, read this helpful guide: How to use robots.txt
To submit your XML sitemap in Google Search Console:
Login to Google search console
Click SITEMAPS under INDEX.
Type in your sitemap filename (i.e. sitemap_index.xml) and click the SUBMIT 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 in your sitemap and how many pages are actually indexed.
You can see all the details in the COVERAGE report (under Index).
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.
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.