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
No Content Found.
Exercises & Assignments
No Content Found.
Interview Questions & Answers
No Content Found.