Error messages in WordPress tend to be confusing and challenging to solve, but the “Your sitemap appears to be an HTML page” error, thankfully, isn’t one of them.
If you’ve encountered this problem, you’re likely wondering what this error means, what’s wrong with your sitemap being HTML, and how exactly you can fix this issue. And what if your sitemap is already in the proper format and you still see this error?
We’ll walk you through everything: how a sitemap works, the format it’s meant to be in, and a few different ways to solve this problem.
What Is a Sitemap?
Do you know how search engines find your website? The answer is with a handy little bot called a web crawler — an automated tool sent out by search engines to index the pages of your site.
With literally millions of pages on the web, gathering information about each site would be impossible with humans. Web crawlers go through the internet, caching the info on every page and piece of media.
That seems simple enough, but Google doesn’t automatically know when you add a new page to your site, such as when you publish a blog post or release a new product in your store. They periodically send the web crawler to visit your site and see if anything has changed, but the process isn’t instantaneous.
When you have a huge website, it’s easy for the crawler to miss key pages even after multiple visits. It’s primarily a concern when such pages aren’t linked to often.
That’s where sitemaps come in to help the crawlers. These XML files are different from a regular page on your site; they’re generally unreadable by humans and not meant to be seen by visitors. But web crawlers can use them to ensure everything gets indexed.
An example of an XML Sitemap.
The way they work is by simply listing out all the pages on your site along with their link hierarchy, plus other files on your site such as images and videos. It ensures that Google sees everything on your site and improves SEO accordingly.
If you’ve used a tool like Google Analytics or Google Search Console, then you may have seen an option to link to your sitemap. Google will reference this first when they send web crawlers to your site.
The homepage of Google Search Console.
Encountering this common WordPress error? 🤯 The solution is just a click away 😌Click to Tweet
Differences Between HTML and XML Sitemaps
So your sitemap is an HTML page, but what exactly is the problem with that? Why does Google want you to change it?
Sitemaps must be written in a particular format for web crawlers to understand them. A majority of the time, it needs to be an XML file. They may also read an RSS, Atom, KML, or text file, but XML is the most common choice.
An example of an RSS Feed.
XML stands for “Extensible Markup Language.” It’s a web language very similar to HTML. The difference is its use: while it’s human-readable, its primary function is to help machines encode documents and read data.
In this case, it’s helping a web crawler understand where the pages and other media on your site are and how they interact with each other.
But you may have seen the term “sitemap” used before in a very different context. HTML sitemaps do exist, but the big difference is that they’re made for humans, not for web crawlers.
If you’ve ever clicked a link to a site’s navigation and found a human-readable and pleasantly designed list of pages on the site, this is technically known as a sitemap. But while it can be helpful to your visitors, it’s not what Google is looking for.
An XML sitemap will look like a mess of unreadable code or a massive wall of links to most users, so if you want to add a helpful navigation page to your site, feel free to create an HTML sitemap alongside it… but you must create an XML sitemap as well.
A sitemap example.
Other Types of Sitemaps
When you think of a sitemap, what comes to mind may be a simple list of the pages on your site. But Google uses several different types of sitemaps to catalog various information. These include:
- Video: Videos on your site can be specially indexed to appear in Google Video results.
- News: Writing a column? Google has a specially dedicated Google News section in its search, and a News Sitemap can ensure you’re appearing properly there and getting more traffic.
- Code: Google indexes code snippets to help programmers search for code and files.
- Geographic data: You can use a special KML sitemap to give Google better data on where your business is.
Typically, some of this information is in your main sitemap. Others must have their special dedicated sitemap. And in the end, they all need to be appropriately formatted in XML or another supported format, not HTML.
How to Generate an XML Sitemap
If you’ve intentionally submitted a link to an HTML sitemap, you’ll need to replace it with an XML file instead. If you don’t know how to make one, there are several different ways to create it with WordPress plugins and generators you can find online.
Even if you have an XML sitemap that just isn’t working, regenerating or submitting a different sitemap may fix the issue.
There are two easy ways to get a sitemap: either use a plugin or generate one with a sitemap.
Generate a Sitemap with a Plugin
With WordPress, the easiest way to get a dynamically updating sitemap on your website is to download a plugin. This way, you don’t have to upload any files to your server manually.
There are quite a few plugins that will generate a sitemap:
- Yoast SEO: The most popular SEO plugin on the repository also comes with generating a sitemap. You can find the settings under SEO > General > Features and XML Sitemaps.
- All in One SEO: SEO sitemaps are super easy to find in AIOSEO; go to All in One SEO > Sitemaps.
- RankMath: Besides a normal sitemap, this SEO plugin can also generate a WooCommerce sitemap and a KML geodata sitemap. Go to RankMath > Sitemap Settings.
- XML Sitemaps: As the name implies, XML Sitemaps will generate a sitemap. The plugin is 100% free and open source, so there are no hidden fees.
- XML Sitemap & Google News: This plugin generates an XML sitemap and a Google News sitemap. It’s also effortless to install and set up.
- Companion Sitemap Generator – HTML & XML: If you want to generate an HTML sitemap alongside an XML sitemap, this is the plugin for you. Both are automatically updated, so you don’t need to do any manual work.
Sitemap Generator Sites
Instead of a plugin, you can use a sitemap generator such as XML-Sitemaps or XML Sitemap Generator. You can then upload it to your site.
Step 1: Generate a sitemap using one of the sites above or any generator of your choice. Download the XML document.
Step 2: Download FileZilla or (if supported) use your web host to connect to your site via FTP.
Step 3: Place the XML file into the root folder of your site. The root is the top-most directory of your site — the same directory you start in when you first connect.
Sign Up For the Newsletter
Want to know how we increased our traffic over 1000%?
Join 20,000+ others who get our weekly newsletter with insider WordPress tips!
Unlike plugin-based sitemaps, sitemaps generated with a website are not dynamic. Static sitemaps won’t update as you publish new posts and pages on your site. You’ll need to make a new file every single time. So for blogs and other sites that update frequently, it’s not ideal.
How to Fix the Sitemap Error
The sitemap error is often caused by accidentally submitting an HTML page rather than a properly formatted XML file. But if your XML sitemap is still claiming to be an HTML page, you may have a deeper problem.
No worries: the issue usually lies with an easy-to-fix conflict in your WordPress plugins. Here are a few suggestions to get your sitemap working correctly again.
Check for Errors and Redirects
It’s much easier to diagnose the problem if you have an explicit error code to search for. The first thing you should do is visit your sitemap page and see if there are any strange error codes.
Kinsta’s 404 error page.
If you notice an error when you visit your sitemap, this will cause Google to think it sees an HTML page. Use this error to help you in your search to fix the problem. Our list of HTTP status codes may help.
What if you notice the sitemap error intermittently — sometimes there and sometimes not? It may happen if you’re dynamically generating a sitemap.
Minor server blips and timeouts will read to Google like your sitemap is suddenly an HTML page as it shows an error message rather than an XML file. As long as the error is rare and is not ongoing or frequent, it’s usually not a cause for concern.
Another thing to look out for is redirects. If you visit your sitemap page and suddenly end up on the homepage or in an infinite redirect loop, this will also cause things to break.
If you find any errors or redirects that won’t go away, the problem usually lies with a plugin conflict. Plugins that generate sitemaps such as Yoast or All in One SEO may cause a conflict, or a caching plugin could be the source of the issue.
But sometimes, even seemingly random plugins can cause conflicts. Use the Health Check & Troubleshooting plugin to identify them.
The Health Check & Troubleshooting plugin after installation.
Install it if it isn’t present already, then go to Tools > Site Health > Troubleshooting Mode. It’ll turn off all plugins temporarily without affecting your visitors.
See if the error or redirect is now gone on your site. If it is, re-enable plugins one by one until the site breaks again. Look for conflicts between multiple plugins.
You can now contact the plugin author(s) to report the bug and ask for assistance.
One of the biggest causes of conflicts is with caching plugins. When a sitemap gets cached, it can occasionally cause issues with Google reading it as an HTML page, as you shouldn’t cache XML files this way.
Most caching plugins will avoid caching a sitemap page because of this, but they may erroneously do so anyway, especially if you’re using a unique URL for your sitemap.
Thankfully, you do not need to disable the entire caching plugin. You can add an exception, and the issue should clear up automatically.
Your plugin’s documentation should cover this, but here’s how to do it in WP Super Cache and W3 Total Cache.
For WP Super Cache, go to Settings > WP Super Cache. Under the Advanced tab, scroll to Add here strings (not a filename) that forces a page not to be cached.
In this section, enter the partial URL of your sitemap. For example, if your sitemap is located at “example-site.com/sitemap.xml,” enter “/sitemap.xml.”
For W3 Total Cache, navigate to Performance > Page Cache, then find Advanced > Never cache the following pages. Just like with WP Super Cache, enter the sitemap URL.
You may also want to add it to Minify under Performance > Minify and Never minify the following pages, as this can lead to problems.
Check Your Sitemap URL
While this is a small suggestion, it’s always worth double-checking: did you submit the correct link? It’s an elementary mistake to make, and even one incorrect character will point to the wrong place.
Check the link you’ve submitted, both via Google and in any SEO or sitemap plugins.
Some plugins may be adding a trailing slash to the end of your sitemap page (“example-site.com/sitemap/” instead of “example-site.com/sitemap”). This one character can lead to massive problems, especially if it causes a redirect loop.
Again, turn on troubleshooting mode in the Health Check plugin and attempt to find which plugin is causing this issue. A majority of the time, you can trace it back to one individual plugin.
Remove Extra Sitemaps
While it won’t usually cause problems as long as you link to the proper page, having extra sitemaps active can occasionally cause issues or confusion for yourself. Plus, your server is spending additional resources updating several unnecessary sitemaps.
Plugins may add different sitemaps, and you may not know that WordPress even generates its own for you. You should check for these and remove all but the one you want to use. Here are a few URLs you can try on your site:
- /sitemap.xml — A common choice for generated sitemaps throughout most plugins. It’s also the URL of choice for All in One SEO.
- /wp-sitemap.xml — This is the default sitemap generated by WordPress since version 5.5.
- /sitemap_index.xml — The URL for the sitemap generated by Yoast.
And if you’ve downloaded other SEO or sitemap plugins, they may be using a different URL entirely. Check the documentation and make sure you disable any sitemap functionality you don’t want.
Do You Really Need a Sitemap?
Sometimes sitemaps can inexplicably be the source of a constant stream of issues. And a simple fix may not be enough to make them go away. If you run into difficult-to-solve problems constantly, you may begin to question whether a sitemap is vital for you.
It’s generally encouraged to create a sitemap, as Google says itself that it will never penalize your SEO for doing so. It can only help improve your SEO and get your site indexed faster.
But it’s not required that you have one in certain situations, and Google itself suggests that some sites not use them.
Suppose your site has fewer than 500 pages and is not likely ever to have more than that. In that case, as long as it’s internally linked well (which you should be doing anyway) and doesn’t have many media files you want to show up in Google Images and Google Video, you may not need to have a sitemap at all.
On the other hand, it really can help your SEO to have a sitemap, and there’s no harm in having one, so pushing through and fixing the problem can do nothing but good. Your site may be small now, but it probably won’t always be.
If you’re stuck, you can always turn to your host’s support to figure out what might be causing the problem.
Wondering what exactly is wrong with your sitemap appearing as an HTML page? 🤔 This post has the answers ⬇️Click to Tweet
The “sitemap appears to be an HTML page” error can be an annoying one to pin down, but it’s usually just the result of an improperly formatted page or an easily fixed caching conflict. Once you’ve figured out the problem, resolving it is just a matter of a few extra steps.
With one error often comes another, so if you’re still having trouble with your site, try checking out our pillar article of 65+ WordPress errors and how to fix them.
If you enjoyed this article, then you’ll love Kinsta’s WordPress hosting platform. Turbocharge your website and get 24/7 support from our veteran WordPress team. Our Google Cloud powered infrastructure focuses on auto-scaling, performance, and security. Let us show you the Kinsta difference! Check out our plans