Sitemap.xml — is a structured .xml file that contains renewable information about website`s pages that need to be indexed by search engines. The file is placed in the root directory of resource. It can be formed manually or automatically by CMS scripts or modules.
In this article we are going to answer all frequently asked questions like: why is it necessary, how to create it, what should be included in it and what kinds of sitemap.xml exist.
So, what is it for. Sitemap can sufficiently boost web resource`s indexation. It helps SE to define nesting level of pages and page’s last modification date. Using sitemap is extra important for big web portals, online stores and other resources with a vast site structure.
Types of sitemap.xml
Each site usually has several sitemaps depending on the content type:
sitemap-category.xml — contains info about 1-4 nesting level pages;
sitemap-products.xml — includes information about product cards of your online store;
sitemap-images.xml — this sitemap contains information about pictures only and for now only Google can “read” it;
sitemap.xml — main sitemap file that includes all other files` info.
All these files have to be placed in the root directory of the website (example: domain.com/sitemap-images.xml) and the main sitemap.xml file should include links to them.
Content of sitemap.xml file
All xml files need to have a clear structure using tags that SE robots understand. Let’s look at it more closely:
This is a part of code that contains just one link.
<?xml version="1.0" encoding="UTF-8"?> <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> <url> <loc>https://www.domain.com</loc> <lastmod>2018-10-05</lastmod> <changefreq>monthly</changefreq> <priority>0.8</priority> </url> </urlset>
<url> — in this block the link for indexation is defined;
<loc> — this is an address of the link
<lastmod> — page`s last modification date;
<changefreq> — defines how often page can be modified (never, weekly, monthly, always, hourly, daily, yearly);
<priority> — this tag sets the priority between pages (from 0.1 to 1.0).
Sitemap-images.xml has a different structure, that contains linking between pages and illustrations. Example:
<?xml version="1.0" encoding="UTF-8"?> <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1"> <url> <loc>http://example.com/primer.html</loc> <image:image> <image:loc>http://example.com/kartinka.jpg</image:loc> </image:image> <image:image> <image:loc>http://example.com/photo.jpg</image:loc> </image:image> </url> </urlset>
General requirements to sitemap XML file
- sitemap.xml file should contain only canonical, indexable pages with 200 response codes;
- UTF-8 encoded;
- each sitemap contains less than 50 000 URL. If there are more than that, second sitemap should be created;
- file size has to be less than 50 Mb;
- files should be generated and modified automatically;
- different sitemap for different subdomains;
- the link to the main sitemap should be defined in robots.txt file;
- when sitemap is created, the link should be added to webmaster tools (Google Search Console, for example);
Ways to create sitemap.xml
There are several ways of sitemap`s creation. We have ranged it according to efficiency and propriety:
- to create requirements for developers is the best, because the sitemap would be created individually and most properly;
- to use CMS modules that generate sitemap automatically (example: WordPress module);
- to use services that scan your website and create sitemap.xml file;
Examples of popular sitemap.xml generating online services: