1. Home
  2. Knowledge Base
  3. How to Add Sitemaps to Robots.txt?

How to Add Sitemaps to Robots.txt?

Sitemaps tell Google which pages on your website are the most important and to be indexed. While there are many ways to create a sitemap, adding it to robots.txt is one of the best ways to ensure that it is seen by Google.

In this knowledge base article, we will show you how to add sitemaps to your robots.txt file using Rank Math. We will also explain the benefits of adding a sitemap and how it can help improve your website’s search engine ranking.

Let’s get started!

1 Benefits of Adding a Sitemap

Adding a sitemap to your website helps Google index your site more quickly. This is because a sitemap tells Google which pages on your website are the most important and to be indexed.

Another benefit of adding a sitemap is that it can help improve your website’s search engine ranking. This is because sitemaps help Google understand the structure of your website and the relationships between your pages and post types.

2 How to Add a Sitemap to Robots.txt Using Rank Math

Adding a sitemap to your robots.txt  file is a great way to ensure that it is seen by Google. In this section, we will show you how to do this using Rank Math.

2.1 Login to Your WordPress Website

First, you need to log in to your WordPress website and install the Rank Math plugin. For more information on how to do this, please see our knowledge base article on How to Install Rank Math.

2.2 Navigate to Edit Robots.txt

Navigate to your robots.txt file in Rank Math which is located under WordPress Dashboard > Rank Math > General Settings > Edit robots.txt as shown below:

Edit robots.txt in Rank Math

2.3 Add Sitemap URL in Your Robots.txt

By default, Rank Math would automatically add a set of rules (including your Sitemap) to your robots.txt file. But you can always add/edit the code as you prefer from the available text area.

Now, here you need to enter the URL of your sitemap in this box. The URL will be different for each website. For example, if your website is example.com, the sitemap URL would be example.com/sitemap.xml. 

You can also add multiple sitemap URLs if you have more than one sitemap. For example, if you have a video sitemap, you would enter the URL for that sitemap as well.

Here’re some of the example reference URLs you can use:

  • Sitemap: https://example.com/sitemap.xml
  • Sitemap: https://example.com/post-sitemap.xml
  • Sitemap: https://example.com/page-sitemap.xml
  • Sitemap: https://example.com/category-sitemap.xml
  • Sitemap: https://example.com/video-sitemap.xml

But instead of listing out individual URLs, you can simply include the Sitemap Index, and search engines can pull out all the individual sitemaps from here. It’s also helpful — if you end up adding/removing sitemaps, you don’t need to make these changes to your robots.txt manually.

  • Sitemap: https://example.com/sitemap_index.xml

For further ado, see the screenshot below:

Adding sitemap in robots.txt file

2.4 Save Your Changes

Once you have added the sitemap URL to your robots.txt file, you need to save your changes. You can do this by clicking on the Save Changes button at the bottom of the page.

Save Changes

Caution: Please be careful while making any major or minor changes to your website via robots.txt. While these changes can improve your search traffic, they can also do more harm than good if you are not careful.

Conclusion:

In the end, we have shown you how to add sitemaps to your robots.txt file using Rank Math. We have also explained the benefits of adding a sitemap and how it can help improve your website’s search engine ranking. We hope this article has been helpful to you. If you have absolutely any questions, please feel free to contact our support team, who are available 24/7 & ready to help.

Was this article helpful?

Still not using Rank Math?

Setup takes less than 5 minutes including the import from your old SEO Plugin!

Learn more about the PRO Version

Still need help?

?

Submit Your Question

Please give us the details, our support team will get back to you.

Open Ticket