How to Generate Sitemaps in WordPress and Use Them Effectively
Sitemaps show the structure of your website along with links, so the web crawlers can index your website effectively and easily. Website owners who don’t use sitemaps may lose traffic and this is the main reason why you also need to generate sitemaps.
In this article we will show you how to generate them and then how to submit the sitemaps in Google Search Console (former Webmaster Tools).
How to Create Sitemaps Manually
If your website contains only few subpages, you can create your sitemap manually. The most common sitemap types are XML and plain text sitemaps.
XML is a markup language and with it, you can easily create your structured sitemap. Just use this code piece and change the urls to your own values:
<?xml version="1.0" encoding="UTF-8"?>
If you have more subpages, then just insert another
code piece before the closing </urlset> tag, where you change the shown url to your own one.
Plain text sitemap
Google accepts sitemaps in plain text too; this means that you only need a single .txt file, where your urls are listed below each other, in a new line, like this:
How to Create Sitemaps with Plugin
To install it, download the plugin from here.
After you have installed and activated the plugin, a new menu item appears in WordPress admin: BWP Sitemaps. By clicking on it, you can generate the sitemap files for your website.
There are different options in BWP Sitemaps to create a sitemap file, some of them are checked by default, while other ones could be added manually. All of them will create independent xml files which are stored in your website’s root directory.
- Site Address, site.xml: this xml file contains only the url of your website. This file is important when you use multi-site WordPress installation, since then you will have more than 1 websites. The site.xml shows Google which websites should be indexed.
- Sitemapindex, sitemapindex.xml: this file contains the list of other xml files.
- Posts, post.xml: this xml file shows the list of your WordPress posts’ url.
- Pages, page.xml: this file lists the url of WordPress pages.
- Categories, taxonomy_category.xml: here you can see the url of your WordPress categories.
- Tags, taxonomy_post_tags.xml: this xml file contains the url of WordPress tags.
How to Confirm your Ownership in Search Console
After your sitemaps are created, you should show them to Google. The easiest way to do this is to register a Google Search Console account. You should add your website first, then confirm your ownership. This can be done in different ways.
The easiest way to confirm the ownership of a website is if it uses a Google Analytics tracking code already. This way you just need to choose this confirmation option, if you are logged into Google Analytics, the Search Console ownership will be confirmed automatically.
If you don’t have Google Analytics on your website, you should download an html file from Search Console, upload it to your website’s root directory, and ask Search Console to detect the script. Once your ownership is confirmed, you can add your sitemaps.
How to Add your Sitemaps to Search Console
To add your sitemaps to Search Console, you should click on Crawl and then on Sitemaps in Console. A new interface appears in the middle of the screen, where you should click on the Add/Test sitemap button. Your website url will be shown automatically, so you should enter your sitemap’s name one by one. For example, add sitemap.xml or post.xml (whichever you have).
By clicking on Test button you can see the test results, where Google shows how many entries it found in the submitted XML file and if there were any errors in it. You can add your sitemap to Google index the same way, just press the Submit button at the end, instead of Test button.
Once Google added your sitemap, a warning message appears: Item submitted. Refresh the page.
Click on Refresh the page link and the page refreshes itself. You should see the newly added sitemap in your Console where you can see how many items were submitted in your sitemap and how many of them were already indexed. The more items are indexed, the more urls will be shown on Google Search Result Pages (SERPs).
How to Create an Onsite Sitemap
XML or plain text sitemaps are useful for Google and other web crawlers, but you should take care of real people, your real visitors. Once your website becomes bigger and bigger, most people will need help in navigation. To give them a helping hand, you should create an onsite sitemap as well.
What is onsite sitemap? It is something that shows all of your website parts and can be used as navigational help to your visitors. As for XML sitemap, you can create the onsite sitemap manually or with a plugin.
If you don’t have WordPress or you have only few subpages, it is recommended that you create the onsite sitemap manually. To do this, simply create a new html page and list your subpages’ name with a link.
The manual method is not convenient when you have hundreds or thousands of posts and pages. Also, if your website content changes regularly, you should use an automatized solution that could keep your onsite sitemap up to date. If you use WordPress, you should use PS Auto Sitemap, since it is one of the best onsite sitemap plugins ever.
How to Add and Configure PS Auto Sitemap Plugin
First, you should download the plugin here.
After you installed and activated it, a new submenu item appears in WordPress backend’s Settings, PS Auto Sitemap. Create a new page, and copy out its ID. Go to PS Auto Sitemap settings and enter this ID into PostID of the sitemap input field. Click on the Save changes button and then go back to your previously created new page.
Open your new page again, and switch to Code view. Insert this code into it:
<!– SITEMAP CONTENT REPLACE POINT –>
By adding this code, the content generated by PS Auto Sitemap appears on the page. Every time you create a new post or page, or delete one, the plugin will update your sitemap page automatically.
As we have mentioned above, you can customize your sitemap content by changing the settings of PS Auto Sitemap plugin:
- Display home list: if this box is checked, the homepage (the url) of website appears on sitemap
- Display post tree: if you want to show your posts’ list on sitemap, check this box
- Display page tree: similar to posts, check this box if you want to show your pages’ list on sitemap
- Depth level: you can set how deep you want to show your link structure, the default is no limit
- Display first: you can set that posts or pages must be shown first on sitemap
- Display of categories & posts: if you set Combine here, then the sitemap will show the categories below each other, and under all of the categories you will see each category’s posts. If you set Divide here, then Categories and Posts will be displayed separately.
- Excluded categories: you can list the ID of those categories here, which shouldn’t be shown on sitemap. You should separate the IDs with commas.
- Select style: you can choose between 13 sitemap styles or decide not to use any of them.
Tips and Tricks about Sitemap
It is important to show the sitemap to your visitors. It won’t help if it almost hidden and no one will find your onsite sitemap. Place it in your header or footer, or between your menu items.
Don’t use too extraordinary sitemap name, since most of visitors will look for name Sitemap and not for Compass or Navigation help.
If your website contains hundreds or thousands of posts or pages, add all of them to your onsite sitemap. A sitemap won’t be of help if you do not show some website elements on it. If you want, you can show a shorter sitemap version at the top, and a detailed version at the bottom. This combined sitemap can’t be created with PS Auto Sitemap, but you can always add some important links at the top of auto generated sitemap content. Just place them above the sitemap content replace point.