Static Site SEO: Sitemap, Robots.txt, and Ads.txt Essentials
中文版本整理中,当前提供英文原文。
Static Site SEO: Sitemap, Robots.txt, and Ads.txt Essentials
Every static site needs proper SEO configuration. This guide covers the essential files: sitemap.xml, robots.txt, and ads.txt.
Why SEO Files Matter
Proper SEO configuration helps:
- Search engine discovery - Crawlers find your pages
- Index control - Specify what to include/exclude
- Monetization - Enable AdSense properly
- Credibility - Signal legitimate publishing
Sitemap.xml
A sitemap lists all pages you want indexed.
Basic Structure
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>https://yoursite.com/</loc>
<lastmod>2026-03-18</lastmod>
<changefreq>weekly</changefreq>
<priority>1.0</priority>
</url>
</urlset>
Best Practices
- List all important pages - Homepage, main sections, key content
- Update regularly - Keep lastmod current
- Prioritize wisely - Higher priority for important pages
- Don’t include - 404 pages, redirects, low-value pages
Common Mistakes
- Including broken links
- Not updating after content changes
- Listing pages with noindex
- Excluding the sitemap from robots.txt
Robots.txt
Robots.txt controls crawler behavior.
Basic Structure
User-agent: *
Allow: /
Disallow: /private/
Disallow: /admin/
Sitemap: https://yoursite.com/sitemap.xml
Key Directives
- Allow - What crawlers can access
- Disallow - What to block
- User-agent - Specific crawler rules
- Sitemap - Point to your sitemap
Best Practices
- Allow public content - Don’t accidentally block indexable pages
- Block private areas - Admin, login, private directories
- Reference sitemap - Help crawlers find it
- Test thoroughly - Use Google Search Console
Ads.txt
Ads.txt is required for AdSense monetization.
Basic Structure
google.com, pub-XXXXXXXXXXXXXXXXXXX, DIRECT, f08c47fec0942fa0
Requirements
- Get your publisher ID - From AdSense dashboard
- Create the file - At yoursite.com/ads.txt
- Include correct line - Your specific publisher entry
- Don’t modify - Only add, never change existing lines
Common Issues
- Wrong publisher ID
- File in wrong location
- Multiple conflicting entries
- Not waiting for propagation
Implementation Order
- Create sitemap.xml - List all public pages
- Create robots.txt - Allow crawling, reference sitemap
- Create ads.txt - If using AdSense
- Submit to search engines - Google Search Console, Bing Webmaster Tools
Verification
Check your setup:
- Sitemap - Submit to Google Search Console
- Robots - Use robots.txt tester
- Ads.txt - Check AdSense dashboard status
Conclusion
Proper SEO configuration is essential for static sites. A correct sitemap helps crawlers find your content, robots.txt controls what’s indexed, and ads.txt enables monetization. Take time to configure these files correctly.