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
urlsettag with the sitemap namespace, and oneurlwithlocfor 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).
lastmodis optional, but add it only if it is the real date of the last change.- Save it as
sitemap.xmlin 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. |