Create XML Sitemaps Manually: Step-by-Step Guide
Understanding the Basic Structure
Required Components
Every XML sitemap needs:
- XML declaration(first line)
- URLset container(wraps all URLs)
- Individual URL entries
Basic Template
xml
Copy
Download
Run
<?xml version=”1.0″ encoding=”UTF-8″?>
<urlset xmlns=”http://www.sitemaps.org/schemas/sitemap/0.9″>
<!– URL entries go here –>
</urlset>
Step-by-Step Creation Process
Step 1: List Your Important URLs
Prioritize:
- Homepage
- Key category/service pages
- High-traffic blog posts
- Product pages (for e-commerce)
Exclude:
❌ Pagination pages beyond page 2-3
❌ Duplicate content (filtered/sorted URLs)
❌ Private pages (login, admin)
Step 2: Create the File
- Open a text editor (Notepad, VS Code, etc.)
- Start with the XML prolog:
xml
Copy
Download
Run
<?xml version=”1.0″ encoding=”UTF-8″?>
Step 3: Add the URLset Container
xml
Copy
Download
Run
<urlset xmlns=”http://www.sitemaps.org/schemas/sitemap/0.9″>
Step 4: Add URL Entries
For each important page:
xml
Copy
Download
Run
<url>
<loc>https://example.com/page-url/</loc>
<lastmod>2023-11-20</lastmod>
<changefreq>monthly</changefreq>
<priority>0.8</priority>
</url>
Step 5: Save the File
- Save as sitemap.xml
- UTF-8 encoding (critical for special characters)
- Advanced Techniques
- Multiple Sitemaps (50,000+ URLs)
Create a sitemap index file:
xml
Copy
Download
Run
<?xml version=”1.0″ encoding=”UTF-8″?>
<sitemapindex xmlns=”http://www.sitemaps.org/schemas/sitemap/0.9″>
<sitemap>
<loc>https://example.com/sitemap-posts.xml</loc>
<lastmod>2023-11-20</lastmod>
</sitemap>
</sitemapindex>
Dynamic Content Handling
For frequently updated sites, add:
xml
Copy
Download
Run
<lastmod>2023-11-20</lastmod>
<changefreq>daily</changefreq>
Image & Video Extensions
Example for product images:
xml
Copy
Download
Run
<url>
<loc>https://example.com/product</loc>
<image:image>
<image:loc>https://example.com/product.jpg</image:loc>
</image:image>
</url>
Check XML Syntax
Use:
- W3C Validator
- Command line: xmllint –noout sitemap.xml
Verify URLs
bash
Copy
Download
# Linux/Mac:
wget –spider -i sitemap.xml 2>&1 | grep ‘^http’
# Windows (PowerShell):
Select-String -Path sitemap.xml -Pattern ‘<loc>’ | ForEach { Invoke-WebRequest $_.Matches.Groups[1].Value -Method Head }
- Submit to Search Engines
- Google Search Console> Sitemaps
- Bing Webmaster Tools
- Add to robots.txt:
Copy
Download
Sitemap: https://example.com/sitemap.xml
Maintenance Best Practices
✔ Update after major content changes
✔ Remove discontinued pages
✔ Monitor Search Console for errors
✔ Revalidate monthly
Manually creating an XML sitemap:
✅ Ensures only high-quality pages are included
✅ Provides better control than automated tools
✅ Improves crawl efficiency
Next Steps:
- Create your first sitemap today
- Validate using free tools
- Submit to search engines