What are XML Sitemaps and Its Importance in SEO? Create and Add XML Sitemaps to Search Console

What are XML Sitemaps and Its Importance in SEO? Create and Add XML Sitemaps to Search Console

March 28, 2024

Think XML Sitemap as a guide of your website that takes the hand of Google and show it all the important pages within your sites. Ever since the advent of Search Engines, XML Sitemaps remain a popular SEO practices among marketers. It increases your chance of indexing faster, even when your internal linking is not up to the mark.

In our last post, we talked about HTML sitemaps, and their importance in SEO, and contribution to user experience. Today, we are going to explore the world of XML Sitemaps, the biggest magnet for Googlebot, and how it can help your links get discovered faster for ranking.

xml sitemap, digital marketing

What is XML Sitemap & How is it Important?

An XML Sitemap contains a list of webpages (links) of a website, so that when Googlebot crawl in the file, it knows which links are important for the website owner. It helps search engines to understand the website structure of the website as well.

Although search engines can find your site links without a sitemap, but that only if you have a great internal linking structure. That means, each and every links are properly structured so that it is pointing to your homepage. However, if you have a website with large number of pages, or a site with complex structure, it’s keep an eye on the internal linking, making your links undiscoverable by googlebot.

This is why you need an XML sitemap, where you add all your website pages along with other essential information, giving a clear instruction to search engine bots that these are the pages you need to crawl and index.

What Does an XML Sitemap Look Like?

An XML sitemap is a structured way of listing website pages so that search engines can easily find them. 

Here’s a basic example of a sitemap with just one page:

<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>https://www.dzinepixel.com/</loc>
<lastmod>2024-03-21</lastmod>
</url>
<url>
<loc>https://www.dzinepixel.com/services</loc>
<lastmod>2024-03-20</lastmod>
</url>
<url>
<loc>https://www.dzinepixel.com/portfolio</loc>
<lastmod>2024-03-18</lastmod>
</url>
<!-- Add more URLs for other pages as needed -->
</urlset>

 

This sitemap includes:

  • An XML version declaration, which helps search engines understand the file type.
  • The URL set, which defines the protocol for search engines.
  • Each URL listed with its location (URL) and when it was last modified (lastmod).

Every sitemap must follow this structure to work properly. Additional properties like priority and changefreq don’t impact how the sitemap functions. The importance of lastmod varies among different search engines.

How to Check If Website Has Xml Sitemap?

You can check your XML Sitemap just by typing your URL followed by /sitemap.xml

For example: https://www.xyz.com/sitemap.xml

This is how your XML Sitemap will look:

How to Check If Website Has Xml Sitemap?

At the end of each line, you will notice date, and time, which tells you when the page was last updated. This helps with SEO, as a recently updated page indicate to Google crawlers that you have some updated contents that needed to be crawled and indexed as soon as possible.

In the image above, you can see the xml sitemap of dzinepixel.com. It shows several index sitemaps such as page-sitemap.xml, blog-sitemap.xml, etc. This categorization of sitemaps is also called splitting an index sitemap, which is ideal to do if you have a huge website. This tells crawlers the site structure in a clear way.

So, if you click on any of the index sitemaps, it will take you to the URLs or sitemap to the specific sitemap.

For example, if I click on the blog-sitemap.xml, it will take me to a different sitemap (image below).

How to Check If Website Has Xml Sitemap?

Does Every Websites Need an XML Sitemap?

In our opinion, yes, it is better to add an XML Sitemap even if you have a small website with 10-20 pages, you may not need it. 

However, XML Sitemaps are a must for:

  • Websites with a large number of pages
  • Websites with large archives
  • Websites containing rich media content
  • Websites with external links

Google says, it’s important for websites to follow a well-planned link architecture (internal linking) strategy so that search engines could index them faster and properly. In fact, internal linking helps Googlebot to find the content easily, and with XML sitemaps you can guide the bots towards your most important links to index.

Besides, as your website grows, it will be even harder to keep tabs on each links, whether they are indexed or not. With XML Sitemaps, all you need to do is update your sitemap and now whenever Googlebot comes to your site, it will index all the links within your sitemap.

Does Google Index All the Pages Within the XML Sitemap?

It may come as a shock to you, unfortunately Google may not index all the links even if they are in the sitemap. This is because Google has a crawl budget that limits it to crawl to a limited number of pages. If you have a website with a small to moderate number of pages then you are out of the woods, but websites with large number of pages such as e-commerce sites with 1000s of product pages may face a crawling issue.

But the good news is, if the link is mentioned in the sitemap, Google will surely index them, may be not on the first attempt. Besides, Google usually prefer indexing pages that are recently updated. That means, if you have changed any content such as text, image, video, or any other elements in a page that means Google will likely index those pages first, before indexing the other ones.

As mentioned earlier, due to limited crawl budget, Google may not link all your pages at once. That’s why you make sure, you prioritize your pages that you need to be indexed. List the pages that you want your audiences to see when they visit in your site, and make sure to include them in your XML Sitemap. Meanwhile, you can choose URLs that is not so important to appear in the search results.

In this case, you can add a “noindex” tag. This means when googlebot enter your site for indexing, it will first index the pages in your sitemap, and if it still have crawl budget, it will index the URLs under the noindex tag. A noindex tag doesn’t guarantee that google will not index it.

For example, let’s assume you write blog about digital marketing, and whenever someone subscribe your newsletter, it takes them to a “Thank You” page. Now, this is the page you may not want Google is index as it doesn’t have any real SEO value.

How to Make Google Find Your Sitemap?

Every time you add a new page, or update contents in a page, it gets indexed by googlebot. Google usually index your page even if you don’t add an xml sitemap, but that may not happen in some cases. To make sure googlebot always crawl and index your pages, make sure to add your XML sitemap in your Google Search Console Account.

All you need to do is create your XML Sitemap, and add that file in the sitemap section, located on the left side of the search console page.

How to Make Google Find Your Sitemap?

Now type “sitemap.xml” on the “enter sitemap URL” space. Click Submit.

Once you submitted the xml sitemap, Google will make it a priority to index it the next time it visit your website.

How to Add Sitemap XML in WordPress via Yoast SEO?

You can add XML sitemap in WordPress manually or use plugins like Yoast SEO. When adding manually, you need to generate the XML file manually and update them in the root directory, and search console respectively.

To add XML Sitemap through Yoast SEO plugin, you need to first install and activate the Yoast SEO plugin.

You can do this by navigating to “Plugins” > “Add New” in your WordPress dashboard, searching for “Yoast SEO,” and then clicking “Install Now” and “Activate.”

Enable XML Sitemaps:

Once the Yoast SEO plugin is activated, go to “SEO” in your WordPress dashboard and then click on “General.”

Go to the “Features” tab.

Scroll down to the “XML sitemaps” section and toggle the switch to enable XML sitemaps.

enable xml sitemap in yoast seo

After enabling XML sitemaps, Yoast SEO will automatically generate your XML sitemap.

You can view your XML sitemap by clicking on the “XML Sitemaps” button in the “Features” tab. This will display a link to your XML sitemap.

Submit XML Sitemap Manually To Search Engine

Once you have the link to your XML sitemap, you can submit it to search engines like Google, Bing, etc.

If you want to submit an updated sitemap, you need to generate a new sitemap. There are various tools you can use, but I prefer xml-sitemaps.com as it’s free and super easy. All you need to do is enter the URL, and click start, and your sitemap.xml file will be ready within seconds.

Now, the next step is to upload the XML sitemap in the root directory, followed by Google Search Console.

You can access your website’s root directory through FTP (File Transfer Protocol) using an FTP client like FileZilla or through your web hosting control panels file manager.

Upload the XML Sitemap in Root Directory:

Navigate to the root directory of your website on your server.

Upload the XML sitemap file (e.g., sitemap.xml) to this directory.

Once uploaded, verify that the XML sitemap is accessible in your website’s root directory by accessing it through a web browser. For example, if your website is example.com, you should be able to access the sitemap at http://example.com/sitemap.xml.

Update XML Sitemap in Google Search Console Account

Log in to your Google Search Console account, select your property (website) located on the top left of the screen.

Update XML Sitemap in Google Search Console Account

How to Create XML Sitemap for Website?

You can create XML Sitemap through manually, sitemap generator tool, or a plugin.
Manually Generate XML Sitemap:
If your website is small and simple, you can manually create an XML sitemap using a text editor or XML editor.
Start by listing all the URLs of your website in an XML format with tags, including the necessary elements like (URL), (last modified date), (change frequency), and (priority).
Example of an XML Sitemap

// Define an array of URLs for your website
$urls = array(
'https://www.example.com/',
'https://www.example.com/about',
'https://www.example.com/services',
'https://www.example.com/contact'
);


// Create the XML sitemap
$xml = '
';

foreach ($urls as $url) {
$xml .= '

' . $url . '
' . date('Y-m-d') . '
';
}

$xml .= '
';

// Set the appropriate headers
header('Content-type: application/xml');

// Output the XML content
echo $xml;
?>

Explanation of the elements:
• : This is the root element of the XML sitemap.
• : Each element represents a single URL on the website.
• : This element contains the URL of the page.
• : This element specifies the last modification date of the page.
• : This element indicates how frequently the page is likely to change. Possible values include “always”, “hourly”, “daily”, “weekly”, “monthly”, “yearly”, and “never”.
• : This element specifies the priority of the page relative to other pages on the site. The value must be a number between 0.0 and 1.0, where 1.0 represents the highest priority.
Note: The xmlns attribute in the element specifies the XML namespace for sitemaps. This attribute is required for XML sitemaps to be valid.

How to Create Xml Sitemap in PHP?

You can create an XML sitemap in PHP by dynamically generating the XML content based on the pages of your website.

Here’s a simple example of how you can achieve this:

// Define an array of URLs for your website
$urls = array(
'https://www.example.com/',
'https://www.example.com/about',
'https://www.example.com/services',
'https://www.example.com/contact'
);
// Create the XML sitemap
$xml = '
';
foreach ($urls as $url) {
$xml .= '

' . $url . '
' . date('Y-m-d') . '
';
}
$xml .= '
';
// Set the appropriate headers
header('Content-type: application/xml');
// Output the XML content
echo $xml;
?>

This PHP script defines an array of URLs for your website and then dynamically generates the XML content for the sitemap, including the and elements for each URL.

Finally, it sets the appropriate headers and outputs the XML content.

You can customize this script to include additional information such as the last modified date for each URL. Make sure to replace ‘https://www.example.com/’ with your actual website URLs.

Xml Sitemap Generator for Blogger

Blogger, Google’s blogging platform, automatically generates XML sitemaps for blogs hosted on its platform. You don’t need to create one manually.

Here’s how you can access your XML sitemap on Blogger:

  1. Access Your Blogger Dashboard: Log in to your Blogger account and navigate to the dashboard for your blog.
  2. Settings: In the left sidebar, click on “Settings”.
  3. Search Preferences: Click on “Search preferences”.
  4. Sitemap: Under the “Crawlers and indexing” section, you’ll find the “Custom robots.txt” option. Click on “Edit” next to it.
  5. Accessing Sitemap: In the custom robots.txt editor, you’ll see a line that looks like this:

Sitemap: https://yourblog.blogspot.com/sitemap.xml

This is the URL of your XML sitemap. You can access it by clicking on the link.

  1. Submitting Sitemap to Google: If you want to submit your sitemap to Google Search Console, copy the sitemap URL and paste it into the “Sitemap” section of your Google Search Console account.

Blogger automatically updates and maintains your XML sitemap, so you don’t need to worry about generating or updating it manually.

Factors to Consider While Submitting XML Sitemap

When submitting an XML sitemap to search engines like Google, several factors should be considered to ensure successful indexing and crawling of your website’s content:

  1. Sitemap Accuracy: Ensure that your XML sitemap accurately represents the structure of your website and includes all relevant URLs that you want to be indexed by search engines.
  2. XML Sitemap Format: Follow the XML sitemap format specified by search engines, including correct syntax, tags, and structure. Use tools or validators to check for any errors in the XML file.
  3. URL Inclusion: Include all important pages of your website in the XML sitemap, such as main content pages, category pages, product pages, and others that you want to be indexed and ranked by search engines.
  4. URL Exclusion: Exclude any pages that you don’t want to be indexed, such as duplicate content, private pages, or pages with sensitive information. Use robots.txt directives or meta tags to prevent indexing of such pages.
  5. Priority and Change Frequency: Although not directly used by search engines, consider adding and attributes to indicate the importance and update frequency of URLs. While these attributes may not impact indexing directly, they can provide additional information to search engines.
  6. Sitemap Size: Keep your XML sitemap within the size limits specified by search engines. For Google, the uncompressed size limit is 50MB and can contain up to 50,000 URLs.
  7. Regular Updates: Update your XML sitemap regularly to reflect any changes or additions to your website’s content. This ensures that search engines have access

Conclusion

XML sitemaps are an essential aspect of website optimization, enabling search engines to crawl and index web pages efficiently. By understanding the importance of XML sitemaps and utilizing tools and techniques for their creation, submission, and validation, website owners can enhance their online visibility and improve their search engine rankings.