Sitemap is a blueprint of your website that help search engines to find, index all of your website's webpage. A sitemap contains XML file that lists your websites URLs.
The sitemap should be standard format. The file itself must be UTF-8 encoded. The sitemap should content below xml tags.
1. Sitemap should begin with an opening <urlset>
tag and end with a closing </urlset>
tag.
2. Specify the namespace within the <urlset>
tag.
3. Include a <url>
entry for each URL, as a parent XML tag.
4. Include a <loc>
child entry for each <url>
parent tag.
In addition to above tags, you can also add other tags in each <url>
parent tag.
1. The <lastmod>
tag which shows date of last modification of the file. This date should be in W3C Datetime format. However you can use YYYY-MM-DD
format.
2. <changefreq>
tag tells search engines how frequently the page is likely to change. This value provides general information to search engines and may not correlate exactly to how often they crawl the page. The valid values include:
hourly
daily
weekly
monthly
yearly
never
3. The <priority>
tag describes priority of this URL relative to other URLs on your site. Valid values range from 0.0 to 1.0. The default priority of a page is 0.5.
Your Sitemap file must be UTF-8 encoded. As with all XML files, any data values like URLs must use entity escape codes for the characters listed in the table below.
Sample XML Sitemap
The below example shows a Sitemap in XML format.
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>https://laravelcode.com/article/how-to-completely-remove-package-from-ubuntu</loc>
<lastmod>2021-03-26T13:37:02+00:00</lastmod>
<changefreq>daily</changefreq>
<priority>1.0</priority>
</url>
<url>
<loc>https://laravelcode.com/article/how-to-create-get-and-post-request-using-python-requests-module</loc>
<lastmod>2021-03-22T13:19:48+00:00</lastmod>
<changefreq>daily</changefreq>
<priority>1.0</priority>
</url>
<url>
<loc>https://laravelcode.com/article/how-to-store-multiple-checkbox-value-in-database-in-laravel8</loc>
<lastmod>2021-03-22T06:31:19+00:00</lastmod>
<changefreq>daily</changefreq>
<priority>1.0</priority>
</url>
<url>
<loc>https://laravelcode.com/article/reactjs-file-uploading-example-with-axio</loc>
<lastmod>2021-03-22T06:14:38+00:00</lastmod>
<changefreq>daily</changefreq>
<priority>1.0</priority>
</url>
</urlset>
Once you have created the Sitemap file and placed it on your webserver, you need to inform the search engines that support this protocol of its location. You can do this by:
1. You can submit the sitemap to search engine Google Search Central, Bing Webmaster etc.
2. You can specify more than one Sitemap file per robots.txt
file.
Sitemap: https://www.website.com/sitemap-file2.xml
3. Ping search engine to your Sitemap url. Example for google: