XML Sitemap Best SEO Practice

What is XML Sitemap?

This is an XML file. We make it for search engine crawlers. We put here those urls which you want to index on the search engines.

example:

Sitemap Elements Metadata Detail Require
Sitemap Header <?xml version=”1.0″ encoding=”UTF-8″?> We specify here xml sitemap version and encoding UTF-8 Mandatory
URL Set <urlset> Show all urls info here Mandatory
URL <url> Show single url info Mandatory
URL Location <loc> Put here page url. Mandatory
Change Frequency <changefreq> How frequently the page is likely to change Optional
Last Modification <lastmod> It is a Last Modification Date of the page.

Date format

YYYY-MM-DD

Optional
Priority <priority>, The priority of this URL relative to other URLs on your site. Valid values range from 0.0 to 1.0. Optional

Lets see some important XML Sitemap Rules:

XML Sitemap Priority and Frequency

Google ignores priority and Change frequency meta data (attribute). You can remove it from the sitemap.

Session Id URLs in XML Sitemap

Don’t include session IDs from URLs in your sitemap to reduce duplicate crawling of those URLs.

Where to Put XML Sitemap

Put your sitemap in root directory of your html host, For example ‘web’, ‘www’ or ‘public_html’. Make sure sitemap is opening publicly.

URL Protocol in XML Sitemap

  • Always use full url in the sitemap with protocol (https/http). Make sure URL character limit in <loc> must not be more than 2048.
  • Use same protocol (http/https) as you are using for the web page. You can’t use both “http” and “https” versions in the xml sitemap, must use one of them otherwise search engine will ignore one protocol urls.

Errors in XML Sitemap

  • Don’t put 3xx (redirection), 4xx (not found error), 5xx (server error) and canonical, noindex, disallow urls in the XML sitemap list, crawlers may face problem to crawl your all pages. And it may also slow the crawl budget (crawling speed).
  • Use same url version as using for web page choose one from www and non-www versions.

XML Sitemap File Size Limit

File size should be maximum 50 MB or You can add 50,000 URLs in a single sitemap. (including any urls like image, video, alternate urls).
– You can compress the xml sitemap in GZip format. It can speed up the crawling.
– Experts recommends that we should add maximum 10-20K urls per page.

Special Characters in XML Sitemap URLs

Search engines cannot read urls which have special characters. To avoid this, use encoded urls.
Example:

XML Sitemap File Name

You can use any valid file name for your xml sitemap url. There are no restrictions.
Examples:
/abc.xml
/xyz.xml
/sitemap.xml
/sitemap1.xml
For compressed file
/sitemap.xml.gz
/abc.xml.gz

Sitemap Index

If you have a big website. You can break your list into multiple sitemaps. Webmasters and robots.txt accept this file too.

XML Sitemap Index Format Example

Source: Sitemap Index Google Search Console Help

Image XML Sitemap

Image XML Sitemap Format Example

Source: Image Sitemap Google Search Console Help

You can also add images, video, news and other format urls in the xml sitemap but the format is different for it as compare to normal url sitemap.
For example: (Image
You can add maximum 1000 images within a single url. CDN (other domain) images are also allowed.

News XML Sitemap

News XML Sitemap Format Example

Source: News Sitemap Google Search Console Help

Video XML Sitemap

Video XML Sitemap Format Example

Source: Video Sitemap Google Search Console Help

XML Sitemap for Language Alternate URLs

If you have separate mobile urls, other language/region urls in your website then specify them in the sitemap.

How to Submit sitemap to Search Engine

  • Search engines don’t know where is your xml sitemap located. There are two best ways to tell the search engines.
    Submit your xml sitemap to Google and Bing/Yahoo webmaster.
  • (Optional) Add sitemap link anywhere in the robots.txt file. (Helpful for non-popular search engines.)
    Syntax
    sitemap: https://www.example.com/sitemap.xml

Ranking Effect by Using XML Sitemap (Google)

There is no direct impact on Google ranking. It just helps to crawl your website’s all pages. You delete your xml sitemap or change urls in the sitemap, no impact on ranking.
Even you have small website with good navigation, you don’t need to have a xml sitemap.
You must use if complex and big website and having an issue in indexing and crawling or not having all url links in the website.

How to Generate XML Sitemap?

There are three types to generate xml sitemap.

  • Manually
  • Using Third Party Tools
  • Using Plugin for WordPress Sites

Noindex URL in XML Sitemap

If you want to speed up deindexing of urls, you can add these urls temporarily in xml sitemap. Google deindex them more frequently than other methods.

Source: XML Sitemap Guide – Search Engine Land

Mobile XML Sitemap

We should tell to search engines about mobile version urls so they can index them easily.

Source: Mobile Sitemap

How to hide XML sitemap from search engines

There is no problem, if your sitemap indexed by google but you feel to remove it due some other reason like you don’t want to see your pages to competitors then how we can hide these xml sitemap files/pages from google. let’s see…

How to check XML sitemap indexed by Google or not?

First, how to check website xml sitemap files which have been indexed by Google.

Just type on google this formula

site:www.websiteurl.com filetype.xml

Here you can see all indexed xml sitemap files

How to remove xml sitemap from Google index

Just add noindex in http header response, we also call it X-Robots tag

HTTP/1.1 200 OK
Date: Tue, 25 May 2010 21:42:43 GMT
(…)
X-Robots-Tag: noindex
(…)

How to Validate XML Sitemap

How to Check XML Sitemap Report in Search Console (Google Webmaster)

Just login your google webmaster account and open sitemap report

 

You can get one more sitemap data from the coverage report > All submitted pages (select it from the top).

Here you can see all crawl errors, valid urls and exclude urls with details.

webmaster sitemap coverage report