Empowering you to understand your world

How To Create A Sitemap For Search Engines

By Nicholas Brown.

If you own a website, there’s a good chance that the topic of sitemaps has come up. If it hasn’t, then you need to check if you have one! Sitemaps inform search engines of which pages are on your website and their locations. Sitemaps can also provide additional information, such as when a web page was last updated.

How To Check If Your Website Has A Sitemap

You can check to see if your website has a sitemap by typing: ‘yourdomain.com/sitemap.xml’ in your web browser. If you get a ‘404‘ error or nothing comes up, then you don’t have an XML sitemap. It is possible that you have a sitemap in another format such as a TXT file or . However, sitemaps are usually XML. To check if your website has a TXT sitemap, type ‘yourdomain.com/sitemap.txt’ in your web browser.

How To Create a Sitemap For Your Website And Format It Correctly

You can create an XML sitemap with few lines of code. The structure of an XML sitemap consists of the XML version tag. That is the first line of the sitemap file. The second line is the version of the sitemap schema you will be using. For this example, we will use version 0.9. Now we can start adding URLs on the next line! See the following example of a sitemap:

<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">

The ‘loc‘ tag must contain the link to the page you are telling search engines to look for. The ‘lastmod‘ tag tells search engines the last time the page was modified.

How To Submit A Sitemap To Google

You can submit a sitemap using multiple methods. The easiest method if you are doing it by manually is to log into Google Search Console, click the ‘Sitemaps’ tab under ‘Indexing’, then you should see ‘Add a new sitemap’. Paste the link to your sitemap in that text field and click submit. Your sitemap should be located in your website’s root directory, which is straight under your domain name. For example: ‘website.com/sitemap.xml’. That ensures that search engines can find it on their own.

How To Submit Your Sitemap To Google Programmatically

There are two ways to automate the submission of your sitemap to Google. The first is to send a GET request to Google with a link to your sitemap as shown below:


If your server runs on Node.js, then you’d send a GET request from that app to the URL above. The same applies to Python-based websites.

How To Send A GET Request From A Node.js App

To send the sitemap using the Google API, you can use a PUT request to the following endpoint:


Account creation is required for the API method.

Subscribe to our newsletter
Get notified when new content is published