How to Generate XML Sitemaps in WordPress using Google XML Sitemaps
In this tutorial:
Generating XML sitemaps can be a lot of work, but with the Google XML Sitemaps plugin for WordPress, sitemaps can be created automatically and with ease. In this article, we will teach you how to install and use the Google XML Sitemaps plugin within your WordPress site to quickly generate sitemaps which will increase the visibility of your site for search engines to see.
Installing the Google XML Sitemaps plugin
To begin, you will need to be logged into your WordPress admin.
Now that you are logged into your WordPress admin, you will need to hover over Plugins on the left side of the page, and click on Add New.
On this page, click on the search box, enter the term "Google XML Sitemaps", then click the Search Plugins button to perform your search within the WordPress plugin database.
Now that you have searched within the WordPress plugin database, you will be presented with a list of search results. As we have searched for the exact name of the Google XML Sitemaps plugin, the first result will be the plugin that you are looking for. To install the Google XML Sitemaps plugin, click Install Now.
WordPress will now automatically download and install the Google XML Sitemaps plugin for you. Once the installation has completed, click the Activate Plugin button to ensure that the Google XML Sitemaps plugin is active on your WordPress site.
Generating an XML sitemap
To generate the XML sitemap of your WordPress site, hover over Settings to the left of your WordPress admin, and click on XML-Sitemap. At the top of the screen, you will see a heading that says The sitemap wasn't generated yet. To generate your initial XML sitemap, click the link that says Click here to build for the first time.
Additional XML sitemap generation options
While the default options are great for most websites, some individuals may want to change particular settings. In this section, we'll take a brief look at each of the options available within the Google XML Sitemaps plugin settings.
Write a normal XML file (your filename): This option allows a standard XML file to be written. You will want to keep this option enabled so that search engines are able to write it in plain text.
Write a gzipped file (your filename + .gz): The option determines if a gzipped file is output. Keeping this option enabled is a good idea as well for bots that prefer a compressed file. This can also decrease your bandwidth as well because a smaller file is being downloaded.
Rebuild sitemap if you change the content of your blog: This option allows the XML sitemap to be rebuilt each time you update the content on your WordPress site. To keep your XML sitemap up to date, you will want to keep this option enabled. Of course, if you have a large amount of content on your site and change things frequently, you may want to disable this option as it can increase the server loads.
Enable manual sitemap building via GET Request: This option will allow you to rebuild an XML sitemap by simply visiting a page on the site. Be very careful with this option if you choose to enable it as bots could reach it and cause your XML sitemap to rebuild on each request, and can dramatically increase the server load. It is, however, useful if you wanted to use a cron job to automatically rebuild your XML sitemaps.
Notify Google about updates of your Blog: This option will allow your site to send a ping to Google letting them know of new or updated content within your site.
Notify Bing (formerly MSN Live Search) about updates of your Blog: This option does the same thing as the previous, in which it will send a ping to Bing notifying them of new or updated content on your site.
Add sitemap URL to the virtual robots.txt file.: This option will edit your robots.txt file, pointing any search engines to your XML sitemap. I recommend keeping this option enabled to ensure that search engines are able to find your XML sitemap.
Limit the number of posts in the sitemap: This field will limit the number of posts that are displayed within your XML sitemap. Keeping this option blank will allow all posts to be displayed.
Try to increase the memory limit to: This field will increase your memory limit when generating new sitemaps. This option can sometimes be helpful if you are receiving errors that the PHP script is using too much memory.
Try to increase the execution time limit to: This field is similar to the previous field in which you will be able to increase the maximum execution time of PHP script. This option is helpful if you are receiving errors that the PHP script has timed out.
Include a XSLT stylesheet: This field will allow you to define a custom XSLT stylesheet for your XML file. Most will use the default, but if you have a particular reasoning for using a custom layout, you may enter the full path to the .xls file here.
Enable MySQL standard mode. Use this only if you're getting MySQL errors.: This option allows for standard MySQL queries to be executed to build your XML sitemap instead of the built-in WordPress functions. You will only want to enable this if you are receiving MySQL errors when generating your sitemap as it can dramatically increase your resource usage.
Build the sitemap in a background process: This option allows sitemaps to be built in the background instead of building them at the same time that the post is saved. I recommend keeping this enabled as it can take quite some time to build the XML sitemap and with it disabled, would force you to wait for the build to complete when a post is saved.
In this section, you will be able to add new pages to your XML sitemap that are not within your WordPress site. For example, if you have a secondary shopping cart that is not included within this WordPress installation, you would add various URLs here to ensure that they are included within your sitemap as well.
In this section, there are 3 different options that you may use to automatically adjust the priority of posts and pages. Post priority allows you to tell Google and other search engines which pages are the most important on your site and ranges from 0.0 to 1.0. By default, post priorities are set to 0.5.
Do not use automatic priority calculation: This option disables the ability for post priorities to be automatically calculated. All posts will have a priority of 0.5 unless specifically defined within the Priorities section.
Comment Count: This option will adjust post priorities within your XML sitemap based on the number of comments on that particular post or page.
Comment Average: This option will adjust the priority based on the average number of comments. For example, if the average number of comments on your posts is 3, a post with 1 comment would be given a below average priority, while one with 10 would be given a higher priority.
Location of your sitemap file
Within this section, you will define the location of the XML sitemap file that the Google XML Sitemap plugin generates. Setting the Automatic detection will automatically place it within the document root for your domain. With this option enabled, you can also set the name of the sitemap XML file if you choose to.
The second option will allow you to set the full path and URL to your sitemap file. I only recommend using this setting if you have a specific reasoning for doing so.
This section determines what type of content that you want to include within your XML sitemap. Here, you can include any type of content within your XML sitemap to ensure that you get the correct exposure from search engines.
This section can be used to exclude particular categories and pages from being indexed within your XML sitemap. Of course, search engines may still index that content, but excluding it from your XML sitemap will ensure that indexing is not encouraged.
Within this section, you will be able to define how often specific content is updated so that search engines know how often to crawl the data. Of course, they are still in control over how often they check for new information, but setting these appropriately will provide them with a good suggestion of how often then should check for changes.
In this section, you will be able to manually change the priority of your individual sections of your site. Setting a higher priority will allow that content to suggest to search engines that it is more important content. While it is up to the search engines in how they interpret this, it is always a good thing to adjust these settings to provide them with suggestions.
Where do I go from here?
Now that you have adjusted all of your options within the Google XML Sitemaps plugin, be sure to click the Update options button to save any changes you have made. With the Google XML Sitemaps plugin enabled and configured, you will now be able to automatically generate an XML sitemap that is rebuilt with any changes that you make on your WordPress site.