Create an XML sitemap for three pages

Description: Create an XML sitemap for the pages https://example.com/, https://example.com/about/ and https://example.com/contact/.

Hint:

  • Use the urlset tag with the sitemap namespace, and one url with loc for each page.

Solution

<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
  <url>
    <loc>https://example.com/</loc>
    <lastmod>2026-09-01</lastmod>
  </url>
  <url>
    <loc>https://example.com/about/</loc>
    <lastmod>2026-08-12</lastmod>
  </url>
  <url>
    <loc>https://example.com/contact/</loc>
    <lastmod>2026-08-12</lastmod>
  </url>
</urlset>

How it works

  • The XML was checked and it is well formed (every tag is closed).
  • lastmod is optional, but add it only if it is the real date of the last change.
  • Save it as sitemap.xml in the root, add it to robots.txt and submit it in Search Console.

Read XML Sitemap.


Learn more about the similar topics:
Tutorials
SEO – Canonical URLs
SEO – Robots.txt
SEO – XML Sitemap
Exercises & Assignments
Write a robots.txt file to block folders
Block all PDF files and URLs with a parameter in robots.txt
Add a canonical tag to a filtered page
Create an XML sitemap for three pages
Interview Questions & Answers
Which is more useful between an HTML sitemap and an XML sitemap?
What is technical SEO?
What is a robots.txt file?
What is an XML sitemap?
What is a canonical tag?
What is crawl budget?
What is duplicate content and how do you fix it?