Updated April 4, 2023
Introduction to XML sitemap
A sitemap is defined as an XML file, a special document with the list of all Websites URLs or links to different web pages added on Metadata about each URL. It is a file of code that resides in a web server and helps a web engine crawler to evaluate the website in ranking and plays a significant role in SEO. It is designed particularly for all search engines like google and Bing to find the relevant Web Pages and tells the search engine which site is more priority. It is molded in the form of the XML file containing mark-up with the tags.
Syntax
The general Format is given as:
<? XML Declaration>
<urlset>
<url>
<loc>
</url>
</loc>
</
urlset>
The first line is an XML declaration that tells the search engine that it is reading the XML file and the version is 1.0. The second line is the container of all URLs; all sitemaps have a standard 0.90. The third line is the parent tag for each URLs. And this tag contains optional properties, which are discussed below.
How does sitemap work in XML?
The sitemap includes small information of Websites like their versions, last updated and also makes it flexible for the crawlers to search efficiently. So, the work process is very simple. Let’s take a Real-time scenario like google, where it is difficult to find a destination without Google maps likewise, and it is sometimes hard for Google to search web pages on the respective website without Sitemap. Placing an XML file with a sitemap on a browser determines how to seek web pages and what is present in the respective page and helps to crawl a page, respectively. For example, Google provides Google Sitemap to find Dynamic Web Pages. XML sitemap cuts the internal links to find the web pages.
Sitemaps are used when a website is larger, or a site has a large number of links, and external links also include media Links.XML Sitemaps are not visible to the users, and the size includes 10MB File size. As stated, XML Sitemaps works well with XML tags, and the most important components include
- <urlset>: Every sitemap starts with the open tag of this element and ends with a close tag. This specifies a link to the respective protocol standard.
- <url>: It determines the sub-link pages with beginning and end.
- <loc>: it specifies the individual web pages in the specified URL’s and a maximum length of the characters is also defined.
The text file that was included has entries like the below:
http://www.demo.com/catalog?item=20
The above statement says that a text file should impose only one URL per line and should start with ‘http’ with UTF-8 encoding in XML declaration. XML sitemap has a maximum count of 50,000 URLs. All the URLs are specified using an index file optionally specified as <sitemapindex>. Other tags include changefreq and priority. Using entity escaping in the URLS enabling the web server to read and encode a location.
Individual URLs definition is given as
<url>
<loc>https://www.nationalparkdc.com/</loc>
<lastmod>2019-04-12T16:55:20+03:00</lastmod> </url>
Placing XmlSite
THE normal URL is sitemap.xml; in another case, we can reference it in the robots.txt file.
Types of Sitemap includes
- Image Sitemaps: Used to surf all the images in the hosted website
- Video Sitemaps: Helps Google to seek Video Content on the Web page
- News Sitemaps: Finds Blogs and News and helps Google to make easy.
- Mobile Sitemaps.
Once we have well-organized websites, it is responsible for the technical teams to create an XML Sitemap and to feed to the webserver and finally distributed to different Search Engines. A sitemap is much beneficial when we create a blog because new cases don’t have backlinks. That is why sitemap needs to submit webmaster tools.
Benefits of Taking Sitemap for any Websites
- Helps in setting Priority to URLs which benefits search engine.
- It benefits the crawlers to crawl and discover the web pages efficiently.
- Placing priority set and last modified terms showed when the page was updated recently.
- It is highly recommended to have a sitemap if any business or individual sites shouldn’t be left unindexed.
Limitations
- The file size is limited.
- a maximum number of URLs count is set.
- making up-to-date.
Note: It is recommended to use XML Sitemap Generator, and now there are few tools available to create on the own. There are few Paid XML site paid which accommodates 500 URLs.
Examples
Here we discuss the Examples mention below
Example #1 – Simple Example with optional tags
sitemap.xml
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>http://www.educba.com/</loc>
<lastmod>2020-02-01</lastmod>
<changefreq>weekly</changefreq>
<priority>0.7</priority>
</url>
</urlset>
Explanation
This is how a simple sitemap is implemented with various tags. The above code specifies an XML sitemap format where the search engine seeks links for subpages. In the above example, we have used a single URL with a different set of optional parameters.
Output:
Example #2 – Using many URLS
site2.xml
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>http://www.google.com/</loc>
<lastmod>2009-02-06</lastmod>
<changefreq>monthly</changefreq>
<priority>0.9</priority>
</url>
<url>
<loc>https://www.google.com/search?q=europecountry+article&oq=europe&aqs</loc>
<changefreq>day</changefreq>
</url>
<url>
<loc>https://www.google.com/search?q=europecountry+article&oq=europe&aqs</loc>
<lastmod>2010-11-20</lastmod>
<changefreq>weekly</changefreq>
</url>
<url>
<loc>https://www.zoho.com/writer/collaborative-writing.html</loc>
<lastmod>2006-11-21T16:00:13+00:00</lastmod>
<priority>0.4</priority>
</url>
<url>
<loc>http://www.example.com/catalog?item=83&desc=vacation_usa</loc>
<lastmod>2006-10-23</lastmod>
</url>
</urlset>
Explanation
The above code uses many URLs to show the sitemap concepts, and we added few entities escaping Characters too.
Output:
Example #3
site3.xml
<?xml version="1.0" encoding="UTF-8"?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<sitemap>
<loc>http://www.demo.com/demo1.xml.cs</loc>
<lastmod>2006-11-02T16:22:14+00:00</lastmod>
</sitemap>
<sitemap>
<loc>http://www.demo.com/demo2.xml.cs</loc>
<lastmod>2007-02-02</lastmod>
</sitemap>
</sitemapindex>
Explanation
The above code explains sitemap indexed files which have two sitemap entries. This file is stored in the directory of the server, which in turn is submitted to search engines. As the websites are dynamic change in nature, the XML file should be structured.
Output:
Conclusion
In this article, we have seen how to use an XML sitemap for all the websites. The initial step is to use the Yoast SEO plugin, which makes the updates automatically. There are also plug-ins available online to use XML Sitemap. With which we can break up the sitemaps into several small sitemaps. This sitemap helps the search engine to rank the sites with indexing based on relevance. Therefore, the final thoughts are we have gone through the basics of sitemap their purpose and creation, and with examples for each type.
Recommended Articles
This is a guide to the XML sitemap. Here we discuss How does sitemap work in XML and the Benefits of Taking Sitemap for any Websites. You may also have a look at the following articles to learn more –