How to Create a Sitemap in WordPress (XML & HTML)
Having a sitemap can be beneficial for SEO. It allows Google to understand your site structure, and retrieve essential pages of a website very fast, even if the internal linking of a site isn’t flawless.
I want to start the Sitemap generation by explaining how to create a sitemap in WordPress because WordPress is by far the most popular CMS with 60.4% of the market share. This means WordPress is used by 33.5% of all the websites online. And, I built this website with WordPress, too!
How do you create a WordPress sitemap? In this article, we will show you how to generate both XML and HTML sitemap in WordPress.
What’s the Difference Between XML and HTML WordPress Sitemap?
The simplest explanation is that XML is primarily for the search engines while HTML is written for the users.
XML sitemap is specially designed for the search engines as it is submitted via webmaster tool for effective crawling of website pages.
Whereas, HTML sitemap is designed for humans as they can clearly see it on the website as a web page and website visitors can follow the links to easily navigate and understand the website.
Some website owners will create XML sitemap only, but some (especially big websites) will create both XML sitemap and HTML sitemap.
How to Create XML WordPress Sitemap?
There are many plugins and ways to Create an XML sitemap in WordPress. Existing plugins for creating a sitemap in WordPress include Yoast SEO, All In One SEO Pack, Google XML Sitemaps, and The SEO Framework. In this post, I will explain how to create an XML sitemap using the Yoast SEO plugin since Yoast is one of the most popular WordPress Plugins.
Yoast SEO creates multiple sitemaps for different types of content. By default, it will generate sitemaps for posts, pages, author, and categories.
Step 1: Install and Activate Yoast SEO Plugin
Go to Plugins from your dashboard and click Add New. Now lookup Yoast SEO in the search bar and hit Install Now. Once the plugin installs, click Activate.
Step 2: Activate XML Sitemaps Feature
Go to SEO -> General in your WordPress dashboard, and enter the Features tab. Now scroll down and navigate to XML sitemaps feature and make sure it’s On.
Hit Save changes once you’re done so all your settings are stored.
Step 3: Verify Your Site’s Sitemap
After activating the option in Yoast SEO, you can verify your website’s sitemap. To do that, you can simply add sitemap_index.xml at the end of your domain address.
For example, your URL should look something like this: https://www.example.com/sitemap_index.xml
Step 4: Summit your XML sitemap to Google
Login to the Search Console -> Register your site by clicking on the Add a property button -> Add your sitemap.
How to Create HTML WordPress Sitemap?
You can manually build a page for your HTML sitemap, or you could take the approach most will take: Use a WordPress plugin. Most people will go with a plugin solution because of its ease of deployment, so let’s explore how that would work.
There are a lot of WordPress HTML sitemap plugins out on the web. Make sure you’re only using plugins on the WordPress plugin repository. Here I take “Simple Sitemap” as an example.
Step 1: Install and activate “Simple Sitemap”.
Step 2: Once you install and activate the plugin, create a new WordPress page and add the [simple-sitemap] shortcode where you want your HTML sitemap to appear:
By default, the shortcode will display all of your pages (not your blog posts). However, you can modify its functionality using the following parameters:
- types – the post types you want to include in the sitemap. For example, “post”, “page”, or any custom post types that you’re using.
- show_label – whether or not to show the heading label.
- links – show the sitemap as links or just text.
- page_depth – the hierarchy of child pages.
- order and orderby – what to order pages by.
- exclude – exclude specific content (by post ID).
For example, if you want to create separate sitemaps for your posts and pages, you could use two separate shortcodes like this:
- [simple-sitemap types=”page”] – a list of all your WordPress pages
- [simple-sitemap types=”post”] – a list of all your WordPress blog posts
Finally, you’ll create a HTML sitemap like this:
Final Thoughts on WordPress Sitemaps
To sum up, sitemaps are an important part of WordPress SEO. Also, it is quite easy for us to create a XML or HTML sitemap on WordPress. No any technical knowledge is needed!
If you still don’t have a sitemap on your WordPress website, create one right now!