July 08, 2024

JaiHoDevs

How many urls lines accepted in Sitemap file size

 

A Sitemap.xml file, which is used by search engines to crawl and index websites, has specific guidelines regarding the number of URLs it can contain. According to the standard protocol:

  1. A single Sitemap file can contain a maximum of 50,000 URLs.
  2. The uncompressed file size should not exceed 50 MB.

If your website has more than 50,000 URLs or if the uncompressed Sitemap file exceeds 50 MB, you can create multiple Sitemap files and then use a Sitemap index file to reference them. A Sitemap index file can list up to 50,000 individual Sitemap files, each of which follows the same guidelines (50,000 URLs and 50 MB limit per file).

The syntax for a Sitemap.xml file is based on XML format. Below is a basic example of a Sitemap.xml file:

<?xml version="1.0" encoding="UTF-8"?>

<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">

  <url>

    <loc>https://www.example.com/</loc>

    <lastmod>2023-01-01</lastmod>

    <changefreq>monthly</changefreq>

    <priority>1.0</priority>

  </url>

  <url>

    <loc>https://www.example.com/page1</loc>

    <lastmod>2023-01-01</lastmod>

    <changefreq>weekly</changefreq>

    <priority>0.8</priority>

  </url>

  <url>

    <loc>https://www.example.com/page2</loc>

    <lastmod>2023-01-01</lastmod>

    <changefreq>weekly</changefreq>

    <priority>0.8</priority>

  </url>

</urlset>


Explanation of the Elements

  • <?xml version="1.0" encoding="UTF-8"?>: This is the XML declaration.
  • <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">: This is the root element, indicating that the file adheres to the Sitemap protocol.
  • <url>: This element contains information about a single URL.
    • <loc>: Specifies the URL of the page.
    • <lastmod>: (Optional) The date the URL was last modified.
    • <changefreq>: (Optional) How frequently the page is likely to change (e.g., always, hourly, daily, weekly, monthly, yearly, never).
    • <priority>: (Optional) The priority of this URL relative to other URLs on your site. Valid values range from 0.0 to 1.0.

Sitemap Index File

If you need to use multiple Sitemap files, you'll need a Sitemap index file to reference them:

<?xml version="1.0" encoding="UTF-8"?>

<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">

  <sitemap>

    <loc>https://www.example.com/sitemap1.xml</loc>

    <lastmod>2023-01-01</lastmod>

  </sitemap>

  <sitemap>

    <loc>https://www.example.com/sitemap2.xml</loc>

    <lastmod>2023-01-01</lastmod>

  </sitemap>

</sitemapindex>


In this file:

  • <sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">: This is the root element for a Sitemap index file.
  • <sitemap>: This element contains information about a single Sitemap file.
    • <loc>: Specifies the URL of the Sitemap file.
    • <lastmod>: (Optional) The date the Sitemap file was last modified.

This structure helps search engines discover and index all the URLs on your website effectively.


Subscribe to get more Posts :