Create and submit a sitemap

A sitemap acts as a roadmap for search engines, guiding them towards all the important pages on your website. This comprehensive guide explains how to create a sitemap and ensure Google can access it for optimal indexing.

Understanding Sitemaps

Before diving into the technical details, it's crucial to grasp the basics of sitemaps. If you're unfamiliar with them, consider reviewing an introductory guide on sitemaps for a foundational understanding.

Google adheres to the established sitemap protocol, supporting various formats, each with its strengths and weaknesses. Choosing the right format depends on the specific website and its setup. Google doesn't favor one format over another.

Let's break down the different sitemap formats:

Sitemap Best Practices

To ensure optimal effectiveness, adhere to these best practices outlined by the sitemap protocol:

Size Limits

  • Each sitemap file, regardless of format, has a size limit of 50MB (uncompressed) or 50,000 URLs.

  • For websites exceeding these limits, divide the sitemap into multiple files.

  • An optional sitemap index file can list all individual sitemaps and be submitted to Google.

  • Submitting multiple sitemaps and/or a sitemap index file allows for performance tracking of each sitemap through Google Search Console.

File Encoding and Location

  • Use UTF-8 encoding for all sitemap files.

  • Host sitemaps anywhere on your website.

  • For optimal impact, place the sitemap at the site's root directory. This ensures the sitemap influences all files within the website, maximizing its effectiveness.

Referenced URLs' Properties

  • Employ fully-qualified, absolute URLs (e.g., https://www.example.com/mypage.html) instead of relative URLs (e.g., /mypage.html). This helps Google accurately crawl the specified URLs.

  • Include URLs you want indexed by Google and appearing in search results.

  • For pages with separate mobile and desktop versions, it's generally recommended to include only the canonical URL in the sitemap. However, if including both is necessary, annotate the URLs to distinguish between the versions.

For a comprehensive list of best practices, refer to the official sitemaps protocol documentation.

Example: XML Sitemap

The XML sitemap format, due to its versatility, is widely used. It allows for the inclusion of additional information, enriching the data provided to Google.

Here's an example illustrating a basic XML sitemap structure:

<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
  <url>
    <loc>https://www.example.com/blog/article-title</loc>
    <lastmod>2023-10-26T12:00:00+00:00</lastmod>
  </url>
  <url>
    <loc>https://www.example.com/about-us</loc>
    <lastmod>2023-10-25T18:30:00+00:00</lastmod>
  </url>
</urlset>

This simple structure can be expanded to incorporate details about images, videos, and other content types.

For detailed examples and comprehensive documentation on XML sitemaps and their extensions, refer to sitemaps.org.

Remember to properly escape all tag values within the XML file according to XML standards.

Last updated