How To Create a Sitemap for a Website

Learn how to create a sitemap for a website manually.

A sitemap is a map of the website structure designed to help search engine crawlers find and index content more efficiently. It also helps ensure all necessary pages are included in a search engine’s index and signals the importance of specific pages.

In other words, it can tell search engine crawlers which pages are most important based on where they are in the site structure.

The benefits of having an effective sitemap include the following.

  • Faster crawling times.
  • Easy access to content by both users and search engine crawlers.
  • The ability to prioritize content for indexing by search engines.
  • Increased visibility of the website in the SERPs.
  • It may improve search engine rankings.

The Steps to Create a Sitemap For a Website

First, gather all the internal links of your website – the web address of all the pages and other content. Next, create a list of the URLs that should be in the sitemap.

Then create the XML document.

Start with the opening tag – <urlset> as the root element, along with the XML version attribute xmlns="http://www.sitemaps.org/schemas/sitemap/0.9".

Then add individual URLs, creating a separate element containing all required information: <loc>, <lastmod>, and <changefreq>. These are the web address, last modified date, and change frequency.

For example, the following code will add a single URL to your sitemap:

<url> 
 <loc>https://example.com/blog</loc> 
 <lastmod>22-10-2015</lastmod > 
 <changefreq>weekly</changefreq > 
</url > 

Finally, close the document by closing off the root element using </urlset>.

Here’s an example of what the finished sitemap will look like with some sample URLs:

<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> 
 <url> 
  <loc>https://example.com/blog</loc> 
  <lastmod>22-10-2015</lastmod > 
  <changefreq>weekly</changefreq > 
 </url > 

 <url> 
  <loc>https://example.com/contact-us</loc> 
  <lastmod>13-09-2019</lastmod >  
   <changefreq>monthly</changefreq >  
 </url >

 <url>    
  <loc>https://example.com/about-us</loc>   
  <lastmod>17-08-2019</lastmod >    	
  <changefreq>yearly</changefreq >    	        
  </url >  
  
   </urlset >  

Where To Place Your Sitemap

  • You can tell search engines where your sitemap is by submitting the URL of the XML file through their webmaster tools portal (e.g., Google’s Search Console).
  • You can link to the sitemap from your website’s footer or in the robots.txt file. That will help ensure that search engine crawlers can find your sitemap easily.
  • It’s better to upload your sitemap file in the root folder since many bots know the common path, yourname.com/sitemap.xml. However, you should have a redirect in place, so the common URL points to the one you’re using, just in case.

More Sitemap Best Practices

  • Prioritize your web pages: Make sure the most important pages on your site are given higher priority than other pages.
  • Remove noindex URLs: If you don’t want certain pages indexed, don’t include them in the sitemap and ensure they’re marked with a noindex tag. For example, this tag tells crawlers not to index the page or include it in their search results.
<meta name="robots" content="noindex">
  • Include only canonical URLs: Ensure all URLs in your sitemap point to their canonical page versions. This will help avoid duplicate content issues.
  • Keep the size of your sitemaps under 50MB (uncompressed) or 50,000 URLs: This is the maximum size limit set by Google, so stay within these limits when creating your sitemaps. If you have more than 50,000 URLs, break up your sitemap into multiple files.
  • Use absolute URLs: Don’t add URLs like /mysite.html. Instead, use the complete URLs of each page to ensure web crawlers follow each link properly.

Wrapping Up

Creating a sitemap is essential to optimizing your website for search engines. But it’s only one thing in a huge list of tasks.

Nevertheless, it helps search engine crawlers identify and index your content more quickly. It also signals to search engines which are the most important areas of the site.

Having a sitemap may also help to improve search engine visibility and rankings.

Lastly, while knowing how to create a sitemap manually is essential, most content management systems (CMS), like WordPress, do it automatically.

Want a heads-up whenever a new article drops? Subscribe here

Open Table of Contents