Sitemap Generation: Helping Search Engines Find Your Content
Search engines need help understanding your site structure. A sitemap tells crawlers what pages exist, when they were updated, and how often they change. It's not optional if you want your content found.
Every modern static site generator includes sitemap support. Hugo, Jekyll, Eleventy, Astro, and Next.js all generate them automatically. Gesttalt now does too.
The sitemap appears at /sitemap.xml in your built site. No configuration required. It includes your home page, blog index, and all published posts with their modification dates and SEO priorities.
Why Sitemaps Matter
Search engines can discover pages by following links. But a sitemap makes the job easier and more reliable. It explicitly lists every URL you want indexed, with metadata that helps crawlers prioritize their work.
For a blog, this means:
- New posts get discovered faster
- Search engines know which pages matter most
- Update frequencies help crawlers optimize their schedules
- Last modification dates prevent unnecessary recrawls
Google Search Console, Bing Webmaster Tools, and other services use sitemaps to improve indexing. Submit your sitemap once, and your content gets found reliably.
What Gets Included
Gesttalt's sitemap follows the Sitemap Protocol 0.9 specification. It includes three types of pages:
Home page (/) - The site root with priority 1.0 and daily change frequency. This is your most important page.
Blog index (/blog/) - The list of all posts with priority 0.9 and daily updates. Second in importance.
Individual posts (/blog/{slug}/) - Each post with priority 0.8, monthly change frequency, and its publication date as the last modification time.
The priorities follow SEO best practices. Your home page gets the highest weight. The blog index comes next. Individual posts have lower priority but include precise timestamps.
Implementation Details
Building the sitemap required solving an interesting problem: generating XML safely without external dependencies.
Zig 0.14 doesn't have a standard XML library. The available third-party options either required newer Zig versions or only supported parsing, not generation. This aligned perfectly with Gesttalt's philosophy of minimal dependencies and frozen specifications.
The solution was a custom XmlWriter utility. It provides a structured API for generating XML with automatic escaping of special characters like &, <, >, ", and '. The writer prevents invalid XML while keeping the code clean and maintainable.
Instead of string concatenation like this:
try writer.print("<title>{s}</title>", .{title}); // Unsafe!
The XmlWriter makes safety explicit:
try xml.writeElement("title", title); // Escapes automatically
This approach follows the same pattern as Gesttalt's TOML parser - simple, focused code that does one thing well without external dependencies. The entire XmlWriter is about 100 lines including tests.
Zero Configuration
Like hot-reloading, sitemap generation requires no setup. Run gesttalt build and sitemap.xml appears in your output directory. Deploy your site and search engines can find it.
The sitemap regenerates on every build, including during development with hot-reload. Changes to content, config, or site structure update the sitemap immediately.
Growing With Your Site
Currently, Gesttalt only supports blog posts as a content type. The sitemap reflects this by including the home page, blog index, and individual posts.
When new content types get added (like documentation pages, portfolios, or project showcases), the sitemap will grow to include them. This is intentional. As your site evolves, search engines need to discover all your content, not just blog posts.
The architecture makes this straightforward. Adding a new content type means updating two places: the file watcher for hot-reload and the sitemap generator. Both are documented in AGENTS.md to ensure future contributors don't forget either piece.
Sitemaps are table stakes for production sites. Having them built-in means one less thing to configure, one less plugin to install, one less dependency to maintain. Your content gets found, and you can focus on writing.