We can't find the internet
Attempting to reconnect
Something went wrong!
Hang in there while we get back on track
Automatically generates and serves XML sitemaps for your Phoenix application with proper routing and controller setup. The feature includes robots.txt integration and follows XML sitemap protocol standards for optimal search engine discovery.
Key Benefits
/sitemap.xml
with proper XML content-type headersImplementation Details
Creates a dedicated SitemapController
with XML template rendering through the :xml
format in your Phoenix router. The implementation includes a SitemapXML
view module using embed_templates
for XML generation, with proper content-type handling and layout bypassing for raw XML output.
Usage Example
# Automatically available at /sitemap.xml
# Template renders with Phoenix URL helpers
<url>
<loc><%= url(~p"/") %></loc>
<changefreq>daily</changefreq>
<priority>1</priority>
</url>
Configuration
Update the robots.txt domain from example.com
to your production domain. Extend the XML template by adding more <url>
entries for additional routes or dynamic content from your database.